diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 597730666..000000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.eslintrc.yml b/.eslintrc.yml index 63fd94673..fc8c9fb1c 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,5 +1,6 @@ extends: [eslint:recommended, google, plugin:jasmine/recommended] -installedESLint: true +parserOptions: + ecmaVersion: 2017 plugins: - jasmine env: @@ -18,3 +19,4 @@ rules: no-eq-null: 0 no-console: 0 no-warning-comments: 0 + no-empty: 0 diff --git a/.gitignore b/.gitignore index 81519f667..0f92907cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -.DS_Store node_modules build npm-debug.log -debug.log -datasources.development.json -.idea +docker-compose.yml diff --git a/.vscode/launch.json b/.vscode/launch.json index ecebe6bce..c3b70b7f0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,45 +2,10 @@ "version": "0.2.0", "configurations": [ { - "name": "Iniciar", - "type": "node", - "request": "launch", - "program": "${workspaceRoot}/services/auth/server/server.js", - "stopOnEntry": false, - "args": [], - "cwd": "${workspaceRoot}", - "preLaunchTask": null, - "runtimeExecutable": null, - "runtimeArgs": [ - "--nolazy" - ], - "env": { - "NODE_ENV": "development" - }, - "console": "internalConsole", - "sourceMaps": false, - "outFiles": [] - }, - { - "name": "Asociar", "type": "node", "request": "attach", - "port": 5858, - "address": "localhost", - "restart": false, - "sourceMaps": false, - "outFiles": [], - "localRoot": "${workspaceRoot}", - "remoteRoot": null - }, - { - "name": "Asociar al proceso", - "type": "node", - "request": "attach", - "processId": "${command:PickProcess}", - "port": 5858, - "sourceMaps": false, - "outFiles": [] + "name": "Attach by Process ID", + "processId": "${command:PickProcess}" } ] } \ No newline at end of file diff --git a/services/auth/Dockerfile b/Dockerfile similarity index 66% rename from services/auth/Dockerfile rename to Dockerfile index 582de9eae..098642bfb 100644 --- a/services/auth/Dockerfile +++ b/Dockerfile @@ -1,13 +1,11 @@ -FROM node:6.9.1 +FROM node:8.9.4 -COPY auth /app - -COPY loopback /loopback +COPY . /app +COPY ../loopback /loopback WORKDIR /app RUN npm install - RUN npm -g install pm2 CMD ["pm2-docker", "./server/server.js"] diff --git a/Jenkinsfile b/Jenkinsfile index 06f77ffed..1e4202752 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,12 +43,18 @@ node stage ("Stopping/Removing Docker") { - sh "docker-compose down --rmi all" + step{ + env.TAG = env.BUILD_NUMBER - 1; + sh "docker-compose down --rmi 'all'" + } } stage ("Generar dockers") { - sh "docker-compose up -d --build" + step{ + env.TAG = env.BUILD_NUMBER + 1; + sh "docker-compose up -d --build" + } } } } \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..3d994d0a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ +Copyright (C) 2018 - Verdnatura Levante S.L. + +This package is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +On Debian systems, the complete text of the GNU General Public +License can be found in "/usr/share/common-licenses/GPL-3". diff --git a/README.md b/README.md index a8df77f6a..176f0761e 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,64 @@ -# Project Title +# Salix -One Paragraph of project description goes here +This project is an Enterprise resource planning (ERP) integrated management of core business processes, in real-time and mediated by software and technology developed with the stack listed below. -### Prerequisites +Salix is also the scientific name of a beautifull tree! :) -For testing purposes you will need to install globally the following items: -npm install -g karma -npm install -g karma-cli +## Prerequisites -## Getting Started // ### Installing +Required applications. -Pull from repo. +* Node.js = 8.9.4 +* NGINX +* Docker -install nodejs v6 or above. +You will need to install globally the following items. +``` +$ npm install -g karma-cli gulp webpack nodemon +``` -install nginx globally. +## Getting Started // Installing -Ask a senior dev for the datasources.development.json files required to run the project. +Pull from repository. -on root run: -npm install -gulp install +Run this commands on project root directory to install Node dependencies. +``` +$ npm install +$ gulp install +``` -lauching nginx: -./dev.sh +Launch application in developer environment. +``` +$ gulp +``` -launching frontend: -gulp client +Also you can run backend and frontend as separately gulp tasks (including NGINX). +``` +$ gulp client +$ gulp services +``` -launching backend: -gulp services +Manually reset fixtures. +``` +$ gulp docker +``` -## Running the tests +## Running the unit tests -for client-side unit tests run from project's root: -karma start +For client-side unit tests run from project's root. +``` +$ karma start +``` -for server-side unit tests run from project's root: -npm run testWatch or test for single run +For server-side unit tests run from project's root. +``` +$ npm run test +``` -### Break down into end to end tests - -on root run: - -gulp docker - -wait 10 secs for db to be ready - -npm run e2e +For end-to-end tests run from project's root. +``` +$ gulp e2e +``` ## Built With @@ -57,12 +68,6 @@ npm run e2e * [loopback](https://loopback.io/) * [docker](https://www.docker.com/) * [gulp.js](https://gulpjs.com/) - -## Versioning - -We use [SourceTree](https://www.sourcetreeapp.com/) for versioning. For the versions available, see the [salix project](https://git.verdnatura.es). - -## License - -This project is licensed under the MIT License - +* [Karma](https://karma-runner.github.io/) +* [Jasmine](https://jasmine.github.io/) +* [Nightmare](http://www.nightmarejs.org/) diff --git a/client/auth/package.json b/client/auth/package.json deleted file mode 100644 index 0206c9e11..000000000 --- a/client/auth/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@salix/auth", - "version": "0.0.0", - "description": "", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://git.verdnatura.es/salix" - } -} diff --git a/client/auth/src/login/locale/en.json b/client/auth/src/login/locale/en.json deleted file mode 100644 index 13b9103d7..000000000 --- a/client/auth/src/login/locale/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "User": "User", - "Password": "Password", - "Do not close session": "Do not close session", - "Enter": "Enter" -} \ No newline at end of file diff --git a/client/auth/src/login/locale/en.yml b/client/auth/src/login/locale/en.yml new file mode 100644 index 000000000..c59a6dd8e --- /dev/null +++ b/client/auth/src/login/locale/en.yml @@ -0,0 +1,4 @@ +User: User +Password: Password +Do not close session: Do not close session +Enter: Enter \ No newline at end of file diff --git a/client/auth/src/login/locale/es.json b/client/auth/src/login/locale/es.json deleted file mode 100644 index 85c5c654d..000000000 --- a/client/auth/src/login/locale/es.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "User": "Usuario", - "Password": "Contraseña", - "Do not close session": "No cerrar sesión", - "Enter": "Entrar" -} \ No newline at end of file diff --git a/client/auth/src/login/locale/es.yml b/client/auth/src/login/locale/es.yml new file mode 100644 index 000000000..9c9ba5905 --- /dev/null +++ b/client/auth/src/login/locale/es.yml @@ -0,0 +1,4 @@ +User: Usuario +Password: Contraseña +Do not close session: No cerrar sesión +Enter: Entrar \ No newline at end of file diff --git a/client/auth/src/login/login.js b/client/auth/src/login/login.js index 229c1a345..22783f9ab 100644 --- a/client/auth/src/login/login.js +++ b/client/auth/src/login/login.js @@ -48,7 +48,6 @@ export default class Controller { onLoginErr(json) { this.loading = false; this.password = ''; - this.focusUser(); let message; @@ -64,6 +63,7 @@ export default class Controller { } this.showMessage(message); + this.focusUser(); } focusUser() { this.$.userField.select(); diff --git a/client/client/package.json b/client/client/package.json deleted file mode 100644 index cc477afbf..000000000 --- a/client/client/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@salix/client", - "version": "0.0.0", - "description": "", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://git.verdnatura.es/salix" - } -} diff --git a/client/client/routes.json b/client/client/routes.json index c938dd8a6..de6bcb562 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -26,7 +26,7 @@ "client": "$ctrl.client" }, "menu": { - "description": "Datos básicos", + "description": "Basic data", "icon": "person" } }, { @@ -37,7 +37,7 @@ "client": "$ctrl.client" }, "menu": { - "description": "Datos fiscales", + "description": "Fiscal data", "icon": "account_balance" } }, { @@ -64,7 +64,7 @@ "client": "$ctrl.client" }, "menu": { - "description": "Consignatarios", + "description": "Addresses", "icon": "local_shipping" } }, { @@ -83,7 +83,7 @@ "client": "$ctrl.client" }, "menu": { - "description": "Acceso web", + "description": "Web access", "icon": "language" } }, { @@ -99,13 +99,67 @@ "client": "$ctrl.client" }, "menu": { - "description": "Notas", + "description": "Notes", "icon": "insert_drive_file" } }, { "url": "/create", "state": "clientCard.notes.create", "component": "vn-note-create" + }, { + "url": "/credit", + "abstract": true, + "state": "clientCard.credit", + "component": "ui-view" + }, { + "url": "/list", + "state": "clientCard.credit.list", + "component": "vn-client-credit-list", + "params": { + "client": "$ctrl.client" + }, + "menu": { + "description": "Credit", + "icon": "credit_card" + } + }, { + "url": "/create", + "state": "clientCard.credit.create", + "component": "vn-client-credit-create", + "params": { + "client": "$ctrl.client" + } + }, { + "url": "/greuge", + "abstract": true, + "state": "clientCard.greuge", + "component": "ui-view" + }, { + "url": "/list", + "state": "clientCard.greuge.list", + "component": "vn-client-greuge-list", + "params": { + "client": "$ctrl.client" + }, + "menu": { + "description": "Greuge", + "icon": "work" + } + }, { + "url": "/create", + "state": "clientCard.greuge.create", + "component": "vn-client-greuge-create", + "params": { + "client": "$ctrl.client" + } + }, { + "url": "/mandate", + "state": "clientCard.mandate", + "component": "vn-client-mandate", + "menu": { + "description": "Mandate", + "icon": "pan_tool" + } } ] } diff --git a/client/client/src/address-create/address-create.html b/client/client/src/address-create/address-create.html index 500f46472..1b861f330 100644 --- a/client/client/src/address-create/address-create.html +++ b/client/client/src/address-create/address-create.html @@ -13,7 +13,7 @@ - + diff --git a/client/client/src/address-create/address-create.js b/client/client/src/address-create/address-create.js index 416726fc5..a8326b3c7 100644 --- a/client/client/src/address-create/address-create.js +++ b/client/client/src/address-create/address-create.js @@ -4,7 +4,7 @@ export default class Controller { constructor($state) { this.address = { clientFk: parseInt($state.params.id), - isEnabled: true + isActive: true }; } } diff --git a/client/client/src/address-create/address-create.spec.js b/client/client/src/address-create/address-create.spec.js index be4177a99..4d17111ef 100644 --- a/client/client/src/address-create/address-create.spec.js +++ b/client/client/src/address-create/address-create.spec.js @@ -19,7 +19,7 @@ describe('Client', () => { it('should define and set address property', () => { expect(controller.address.clientFk).toBe(1234); - expect(controller.address.isEnabled).toBe(true); + expect(controller.address.isActive).toBe(true); }); }); }); diff --git a/client/client/src/address-create/locale/es.json b/client/client/src/address-create/locale/es.json deleted file mode 100644 index d2d636765..000000000 --- a/client/client/src/address-create/locale/es.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Street address": "Dirección postal", - "Default": "Predeterminado", - "Consignee": "Consignatario", - "Postcode": "Código postal", - "Town/City": "Ciudad", - "Province": "Provincia", - "Agency": "Agencia", - "Phone": "Teléfono", - "Mobile": "Móvil" -} \ No newline at end of file diff --git a/client/client/src/address-create/locale/es.yml b/client/client/src/address-create/locale/es.yml new file mode 100644 index 000000000..922d758d5 --- /dev/null +++ b/client/client/src/address-create/locale/es.yml @@ -0,0 +1,9 @@ +Street address: Dirección postal +Default: Predeterminado +Consignee: Consignatario +Postcode: Código postal +Town/City: Ciudad +Province: Provincia +Agency: Agencia +Phone: Teléfono +Mobile: Móvil \ No newline at end of file diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html index d94324c92..f703c3803 100644 --- a/client/client/src/address-edit/address-edit.html +++ b/client/client/src/address-edit/address-edit.html @@ -1,4 +1,4 @@ - + -
+ Address - + - + - + @@ -36,8 +36,8 @@ + + + Notes + + + + {{$parent.$parent.item.description}} + + + + + + + + + + + + diff --git a/client/client/src/address-edit/address-edit.js b/client/client/src/address-edit/address-edit.js index caad023e2..8d7a56994 100644 --- a/client/client/src/address-edit/address-edit.js +++ b/client/client/src/address-edit/address-edit.js @@ -1,13 +1,137 @@ import ngModule from '../module'; export default class Controller { - constructor($state) { + constructor($state, $scope, $http, $q, $translate, vnApp) { + this.$state = $state; + this.$scope = $scope; + this.$http = $http; + this.$q = $q; + this.$translate = $translate; + this.vnApp = vnApp; + this.address = { id: parseInt($state.params.addressId) }; + this.observations = []; + this.observationsDictionary = {}; + this.observationsRemoved = []; + } + + _setIconAdd() { + if (this.observations.length) { + this.observations.map(element => { + element.showAddIcon = false; + return true; + }); + this.observations[this.observations.length - 1].showAddIcon = true; + } else { + this.addObservation(); + } + } + + _setDirtyForm() { + if (this.$scope.form) { + this.$scope.form.$setDirty(); + } + } + _unsetDirtyForm() { + if (this.$scope.form) { + this.$scope.form.$setPristine(); + } + } + + addObservation() { + this.observations.push({observationTypeFk: null, addressFk: this.address.id, description: null, showAddIcon: true}); + this._setIconAdd(); + } + + removeObservation(index) { + let item = this.observations[index]; + if (item) { + this.observations.splice(index, 1); + this._setIconAdd(); + if (item.id) { + this.observationsRemoved.push(item.id); + this._setDirtyForm(); + } + } + } + _submitObservations(objectObservations) { + return this.$http.post(`/client/api/AddressObservations/crudAddressObservations`, objectObservations); + } + + submit() { + this._unsetDirtyForm(); + let submitWatcher = this.$scope.watcher.dataChanged(); + let submitObservations; + let repeatedTypes = false; + let observationsObj = { + delete: this.observationsRemoved, + create: [], + update: [] + }; + + for (let i = 0; i < this.observations.length; i++) { + let observation = this.observations[i]; + // only one observation is allowed for each of its types + if (this.observationsDictionary[observation.observationTypeFk] !== undefined && // IF the dictionary contains the type + ( + // AND (is a new Observation OR is old but with distinct Id) --> repeated + !observation.id || (observation.id && this.observationsDictionary[observation.observationTypeFk].id !== observation.id) + ) + ) { + repeatedTypes = true; + break; + } + + if (!observation.id && observation.observationTypeFk && observation.description) { + observationsObj.create.push(observation); + } else if (observation.id && this.observationsDictionary[observation.observationTypeFk].description !== observation.description) { + observationsObj.update.push(observation); + } + + this.observationsDictionary[observation.observationTypeFk] = observation; + } + + submitObservations = observationsObj.update.length > 0 || observationsObj.create.length > 0 || observationsObj.delete.length > 0; + + if (repeatedTypes) { + this.vnApp.showMessage( + this.$translate.instant('you can not repeat the types of observations') + ); + } else if (submitWatcher && !submitObservations) { + this.$scope.watcher.submit().then(() => { + this.$state.go('clientCard.addresses.list', {id: this.$state.params.id}); + }); + } else if (!submitWatcher && submitObservations) { + this._submitObservations(observationsObj).then(() => { + this.$state.go('clientCard.addresses.list', {id: this.$state.params.id}); + }); + } else if (submitWatcher && submitObservations) { + this.$q.all([this.$scope.watcher.submit(), this._submitObservations(observationsObj)]).then(() => { + this.$state.go('clientCard.addresses.list', {id: this.$state.params.id}); + }); + } else { + this.vnApp.showMessage( + this.$translate.instant('No changes to save') + ); + } + } + + $onInit() { + let filter = { + where: {addressFk: this.address.id}, + include: {relation: 'observationType'} + }; + this.$http.get(`/client/api/AddressObservations?filter=${JSON.stringify(filter)}`).then(res => { + this.observations = res.data; + res.data.forEach(item => { + this.observationsDictionary[item.observationTypeFk] = Object.assign({}, item); + }); + }); } } -Controller.$inject = ['$state']; +Controller.$inject = ['$state', '$scope', '$http', '$q', '$translate', 'vnApp']; ngModule.component('vnAddressEdit', { template: require('./address-edit.html'), diff --git a/client/client/src/address-edit/address-edit.spec.js b/client/client/src/address-edit/address-edit.spec.js index 129708241..18fff508f 100644 --- a/client/client/src/address-edit/address-edit.spec.js +++ b/client/client/src/address-edit/address-edit.spec.js @@ -5,20 +5,33 @@ describe('Client', () => { let $componentController; let $state; let controller; + let $httpBackend; beforeEach(() => { angular.mock.module('client'); }); - beforeEach(angular.mock.inject((_$componentController_, _$state_) => { + beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => { $componentController = _$componentController_; $state = _$state_; - $state.params.addressId = '1234'; + $httpBackend = _$httpBackend_; + $state.params.addressId = '1'; controller = $componentController('vnAddressEdit', {$state: $state}); })); it('should define and set address property', () => { - expect(controller.address.id).toBe(1234); + expect(controller.address.id).toBe(1); + }); + + describe('$onInit()', () => { + it('should perform a GET query to receive the address observations', () => { + let filter = {where: {addressFk: 1}, include: {relation: 'observationType'}}; + let res = ['some notes']; + $httpBackend.when('GET', `/client/api/AddressObservations?filter=${JSON.stringify(filter)}`).respond(res); + $httpBackend.expectGET(`/client/api/AddressObservations?filter=${JSON.stringify(filter)}`); + controller.$onInit(); + $httpBackend.flush(); + }); }); }); }); diff --git a/client/client/src/address-edit/locale/es.json b/client/client/src/address-edit/locale/es.json deleted file mode 100644 index 9b2d835e4..000000000 --- a/client/client/src/address-edit/locale/es.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Enabled": "Activo", - "Is equalizated": "Recargo de equivalencia" -} \ No newline at end of file diff --git a/client/client/src/address-edit/locale/es.yml b/client/client/src/address-edit/locale/es.yml new file mode 100644 index 000000000..aad6a3c87 --- /dev/null +++ b/client/client/src/address-edit/locale/es.yml @@ -0,0 +1,2 @@ +Enabled: Activo +Is equalizated: Recargo de equivalencia \ No newline at end of file diff --git a/client/client/src/addresses/addresses.html b/client/client/src/addresses/addresses.html index 8ec33bc5e..d313c188f 100644 --- a/client/client/src/addresses/addresses.html +++ b/client/client/src/addresses/addresses.html @@ -1,33 +1,39 @@ - + Addresses - - + + - star - star_border + star + star_border - -
{{::i.consignee}}
-
{{::i.street}}
-
{{::i.city}}, {{::i.province}}
-
{{::i.phone}}, {{::i.mobile}}
-
- + +
{{::address.nickname}}
+
{{::address.street}}
+
{{::address.city}}, {{::address.province}}
+
{{::address.phone}}, {{::address.mobile}}
+
+ + + {{::observation.observationType.description}}: + {{::observation.description}} + + +
-
+
- + { - this.$scope.index.accept(); - }); + let params = {isDefaultAddress: true}; + this.$http.patch(`/client/api/Addresses/${id}`, params).then( + () => this.$scope.index.accept() + ); } } ClientAddresses.$inject = ['$http', '$scope']; diff --git a/client/client/src/addresses/locale/es.json b/client/client/src/addresses/locale/es.json deleted file mode 100644 index dc7a13c4a..000000000 --- a/client/client/src/addresses/locale/es.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Addresses": "Consignatarios", - "Set as default": "Establecer como predeterminado" -} \ No newline at end of file diff --git a/client/client/src/addresses/locale/es.yml b/client/client/src/addresses/locale/es.yml new file mode 100644 index 000000000..052e19ff3 --- /dev/null +++ b/client/client/src/addresses/locale/es.yml @@ -0,0 +1 @@ +Set as default: Establecer como predeterminado \ No newline at end of file diff --git a/client/client/src/basic-data/basic-data.html b/client/client/src/basic-data/basic-data.html index 5ee41ce7d..3242f857a 100644 --- a/client/client/src/basic-data/basic-data.html +++ b/client/client/src/basic-data/basic-data.html @@ -19,8 +19,7 @@ + info="You can save multiple emails"> @@ -30,10 +29,9 @@ url="/client/api/Clients/activeSalesPerson" show-field="name" value-field="id" - select-fields="surname" + select-fields="name" label="Salesperson" - filter-search="{where: {or: [{name: {regexp: 'search'}}, {surname: {regexp: 'search'}}]}}" - > + filter-search="{where: {or: [{name: {regexp: 'search'}}, {name: {regexp: 'search'}}]}}"> - + Puede guardar varios correos electrónicos encadenándolos mediante comas + sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer + correo electrónico el principal +Contact: Contacto \ No newline at end of file diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html index 5ec67fa6e..b4d307856 100644 --- a/client/client/src/billing-data/billing-data.html +++ b/client/client/src/billing-data/billing-data.html @@ -19,28 +19,24 @@ label="Pay method"> - - - - - + - + - + - +
- + { - this.vnApp.showMessage(this.translate.instant('Notification sent!')); - } + this.$http.post(`/mailer/notification/payment-update/${this.client.id}`).then( + () => this.vnApp.showMessage(this.translate.instant('Notification sent!')) ); } } diff --git a/client/client/src/billing-data/billing-data.spec.js b/client/client/src/billing-data/billing-data.spec.js index df169b18c..9cdf03cac 100644 --- a/client/client/src/billing-data/billing-data.spec.js +++ b/client/client/src/billing-data/billing-data.spec.js @@ -14,6 +14,7 @@ describe('Client', () => { beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => { $componentController = _$componentController_; $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $scope = $rootScope.$new(); let submit = jasmine.createSpy('submit').and.returnValue(Promise.resolve()); $scope.watcher = {submit}; @@ -25,9 +26,6 @@ describe('Client', () => { describe('copyData()', () => { it(`should define billData using client's data`, () => { controller.client = { - credit: 1000000000000, - creditInsurance: null, - discount: 99, dueDay: 0, iban: null, payMethodFk: 1 @@ -72,8 +70,8 @@ describe('Client', () => { describe('returnDialog()', () => { it('should request to send notification email', () => { controller.client = {id: '123'}; - $httpBackend.when('POST', `/mailer/manuscript/payment-update/${controller.client.id}`).respond('done'); - $httpBackend.expectPOST(`/mailer/manuscript/payment-update/${controller.client.id}`); + $httpBackend.when('POST', `/mailer/notification/payment-update/${controller.client.id}`).respond('done'); + $httpBackend.expectPOST(`/mailer/notification/payment-update/${controller.client.id}`); controller.returnDialog('ACCEPT'); $httpBackend.flush(); }); diff --git a/client/client/src/billing-data/locale/es.json b/client/client/src/billing-data/locale/es.json deleted file mode 100644 index 1d643a934..000000000 --- a/client/client/src/billing-data/locale/es.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "Changed terms": "Has modificado las condiciones de pago", - "Notify customer?" : "¿Deseas notificar al cliente de dichos cambios?", - "No": "No", - "Yes, notify": "Sí, notificar", - "Notification sent!": "¡Notificación enviada!", - "Notification error": "Error al enviar notificación", - "You changes the equivalent tax": "Has cambiado el recargo de equivalencia", - "Do you want to spread the change to their consignees?" : "¿Deseas propagar el cambio a sus consignatarios?", - "Yes, propagate": "Si, propagar", - "Equivalent tax spreaded": "Recargo de equivalencia propagado", - "Invoice by address": "Facturar por consignatario", - "Equalization tax": "Recargo de equivalencia" -} \ No newline at end of file diff --git a/client/client/src/billing-data/locale/es.yml b/client/client/src/billing-data/locale/es.yml new file mode 100644 index 000000000..5698aaa0e --- /dev/null +++ b/client/client/src/billing-data/locale/es.yml @@ -0,0 +1,17 @@ +Changed terms: Has modificado las condiciones de pago +Notify customer?: ¿Deseas notificar al cliente de dichos cambios? +No: No +Yes, notify: Sí, notificar +Notification sent!: ¡Notificación enviada! +Notification error: Error al enviar notificación +You changes the equivalent tax: Has cambiado el recargo de equivalencia +Do you want to spread the change to their consignees?: ¿Deseas propagar el cambio a sus consignatarios? +Yes, propagate: Si, propagar +Equivalent tax spreaded: Recargo de equivalencia propagado +Invoice by address: Facturar por consignatario +Equalization tax: Recargo de equivalencia +Due day: Vencimiento +Received core VNH: Recibido core VNH +Received core VNL: Recibido core VNL +Received B2B VNL: Recibido B2B VNL +SAVE: GUARDAR \ No newline at end of file diff --git a/client/client/src/card/card.html b/client/client/src/card/card.html index e9ebd07a0..623bdfbc4 100644 --- a/client/client/src/card/card.html +++ b/client/client/src/card/card.html @@ -1,18 +1,16 @@ - + - - - - - - - - - + + + + + + + + + + diff --git a/client/client/src/card/card.js b/client/client/src/card/card.js index b21c3f636..9660ce3ce 100644 --- a/client/client/src/card/card.js +++ b/client/client/src/card/card.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './style.css'; export default class Controller { constructor() { diff --git a/client/client/src/card/style.css b/client/client/src/card/style.css deleted file mode 100644 index 195879409..000000000 --- a/client/client/src/card/style.css +++ /dev/null @@ -1,3 +0,0 @@ -vn-descriptor { - font-family: raleway-bold; -} \ No newline at end of file diff --git a/client/client/src/client.js b/client/client/src/client.js index 6dc0de725..d61f4e4aa 100644 --- a/client/client/src/client.js +++ b/client/client/src/client.js @@ -14,3 +14,8 @@ import './address-edit/address-edit'; import './notes/notes'; import './note-create/note-create'; import './web-access/web-access'; +import './credit-list/credit-list'; +import './credit-create/credit-create'; +import './greuge-list/greuge-list'; +import './greuge-create/greuge-create'; +import './mandate/mandate'; diff --git a/client/client/src/create/create.html b/client/client/src/create/create.html index 5d1f62db9..50686c1a8 100644 --- a/client/client/src/create/create.html +++ b/client/client/src/create/create.html @@ -1,4 +1,4 @@ - +
- - + + + - - + diff --git a/client/client/src/create/locale/es.json b/client/client/src/create/locale/es.json deleted file mode 100644 index aefe3ac37..000000000 --- a/client/client/src/create/locale/es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Name": "Nombre", - "Tax number": "NIF/CIF", - "Business name": "Razón social", - "User name": "Nombre de usuario", - "Email": "Correo electrónico", - "Create and edit": "Crear y editar", - "Create": "Crear", - "You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main": "Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal" -} \ No newline at end of file diff --git a/client/client/src/create/locale/es.yml b/client/client/src/create/locale/es.yml new file mode 100644 index 000000000..c20f5a8ec --- /dev/null +++ b/client/client/src/create/locale/es.yml @@ -0,0 +1,11 @@ +Name: Nombre +Tax number: NIF/CIF +Business name: Razón social +User name: Nombre de usuario +Email: Correo electrónico +Create and edit: Crear y editar +Create: Crear +You can save multiple emails: >- + Puede guardar varios correos electrónicos encadenándolos mediante comas + sin espacios, ejemplo: user@dominio.com, user2@dominio.com siendo el primer + correo electrónico el principal \ No newline at end of file diff --git a/client/client/src/credit-create/credit-create.html b/client/client/src/credit-create/credit-create.html new file mode 100644 index 000000000..c02ff7167 --- /dev/null +++ b/client/client/src/credit-create/credit-create.html @@ -0,0 +1,23 @@ + + + +
+ + + Add credit + + + + + + + + + + + +
diff --git a/client/client/src/credit-create/credit-create.js b/client/client/src/credit-create/credit-create.js new file mode 100644 index 000000000..2d0bccf56 --- /dev/null +++ b/client/client/src/credit-create/credit-create.js @@ -0,0 +1,8 @@ +import ngModule from '../module'; + +ngModule.component('vnClientCreditCreate', { + template: require('./credit-create.html'), + bindings: { + client: '<' + } +}); diff --git a/client/client/src/credit-create/locale/es.yml b/client/client/src/credit-create/locale/es.yml new file mode 100644 index 000000000..e6151420c --- /dev/null +++ b/client/client/src/credit-create/locale/es.yml @@ -0,0 +1 @@ +Add credit: Añadir crédito \ No newline at end of file diff --git a/client/client/src/credit-list/credit-list.html b/client/client/src/credit-list/credit-list.html new file mode 100644 index 000000000..93be0f162 --- /dev/null +++ b/client/client/src/credit-list/credit-list.html @@ -0,0 +1,27 @@ + + + + Credit + + + + + + + + {{::credit.amount | number:2}} € + {{::credit.created | date:'dd/MM/yyyy HH:mm' }} + {{::credit.worker.firstName}} {{::credit.worker.name}} + + + No results + + + + + + + \ No newline at end of file diff --git a/client/client/src/credit-list/credit-list.js b/client/client/src/credit-list/credit-list.js new file mode 100644 index 000000000..c1d283e33 --- /dev/null +++ b/client/client/src/credit-list/credit-list.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import FilterClientList from '../filterClientList'; + +class ClientCreditList extends FilterClientList {} + +ngModule.component('vnClientCreditList', { + template: require('./credit-list.html'), + controller: ClientCreditList +}); diff --git a/client/client/src/credit-list/locale/es.yml b/client/client/src/credit-list/locale/es.yml new file mode 100644 index 000000000..b4b5940cf --- /dev/null +++ b/client/client/src/credit-list/locale/es.yml @@ -0,0 +1,3 @@ +Since : Desde +Employee : Empleado +No results: Sin resultados \ No newline at end of file diff --git a/client/client/src/descriptor/descriptor.html b/client/client/src/descriptor/descriptor.html index 64dd29fe4..bf1a99337 100644 --- a/client/client/src/descriptor/descriptor.html +++ b/client/client/src/descriptor/descriptor.html @@ -1,15 +1,18 @@ - - - - - person - - -
{{::$ctrl.client.id}}
-
{{$ctrl.client.name}}
-
{{$ctrl.client.phone}}
- + + + + person + + + + + {{::title}}: + + {{$ctrl.client[field] || 0 | number:2}} € + {{$ctrl.client[field]}} + + -
+
diff --git a/client/client/src/descriptor/descriptor.js b/client/client/src/descriptor/descriptor.js index 1311e5858..ec70d0fa1 100644 --- a/client/client/src/descriptor/descriptor.js +++ b/client/client/src/descriptor/descriptor.js @@ -1,26 +1,32 @@ import ngModule from '../module'; export default class Controller { - constructor($scope, $http) { - this.$http = $http; + constructor($translate) { + this.$translate = $translate; + // CLient fields to display + this.fields = ['id', 'name', 'phone', 'credit', 'creditInsurance']; + this.fieldsToShow = {}; } - set active(value) { - if (this._active !== value && this._active !== undefined) - this.$http.put(`/client/api/Clients/${this.client.id}/activate`); - this._active = value; + // concat 2 Arrays without duplicates + _concatFields(a, b) { + return a.concat(b.filter(item => a.indexOf(item) < 0)); } - get active() { - return this._active; + + $onInit() { + let fields = (this.moreFields && this.moreFields instanceof Array) ? this._concatFields(this.fields, this.moreFields) : this.fields; + fields.forEach(field => { + this.fieldsToShow[field] = this.$translate.instant(field); + }); } } -Controller.$inject = ['$scope', '$http']; +Controller.$inject = ['$translate']; ngModule.component('vnDescriptor', { template: require('./descriptor.html'), controller: Controller, bindings: { client: '<', - active: '<' + moreFields: ' { describe('Component vnDescriptor', () => { let $componentController; - let $scope; + let $translate; let controller; beforeEach(() => { angular.mock.module('client'); }); - beforeEach(angular.mock.inject((_$componentController_, $rootScope) => { + beforeEach(angular.mock.inject((_$componentController_, _$translate_) => { $componentController = _$componentController_; - $scope = $rootScope.$new(); - controller = $componentController('vnDescriptor', {$scope: $scope}); + $translate = _$translate_; + controller = $componentController('vnDescriptor', {$translate: $translate}); })); - describe('set active', () => { - it('should check if active is defined and diferent from the new value', () => { - controller.client = {id: 1}; + describe('onInit()', () => { + it('should create Object with basic fields', () => { + controller.client = { + id: 1, + name: "Peter Parker", + phone: null, + mobile: "666666", + credit: 300, + creditInsurance: null + }; + controller.$onInit(); - expect(controller._active).toBe(undefined); - controller.active = false; - - expect(controller._active).toBe(false); - controller.active = true; - - expect(controller._active).toBe(true); + expect(controller.fieldsToShow.id).toBe('id'); }); }); }); diff --git a/client/client/src/filterClientList.js b/client/client/src/filterClientList.js new file mode 100644 index 000000000..6b6f48bb9 --- /dev/null +++ b/client/client/src/filterClientList.js @@ -0,0 +1,40 @@ +// Generic object to list models, related to the client, with mgCrud +export default class FilterClientList { + constructor($scope, $timeout, $state) { + this.$ = $scope; + this.$timeout = $timeout; + this.$state = $state; + + this.waitingMgCrud = 0; + this.clientFk = $state.params.id; + } + onOrder(field, order) { + this.filter(`${field} ${order}`); + } + filter(order) { + if (this.$.index && this.clientFk) { + this.waitingMgCrud = 0; + this.$.index.filter = { + page: 1, + size: 10, + clientFk: this.clientFk + }; + + if (order) { + this.$.index.filter.order = order; + } + + this.$.index.accept(); + } else if (!this.clientFk) { + throw new Error('Error: ClientFk not found'); + } else if (this.waitingMgCrud > 3) { + throw new Error('Error: Magic Crud is not loaded'); + } else { + this.waitingMgCrud++; + this.$timeout(() => { + this.filter(order); + }, 250); + } + } +} +FilterClientList.$inject = ['$scope', '$timeout', '$state']; diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index f9c9c418b..a9de01bf8 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -10,8 +10,9 @@ Fiscal data - - + + + @@ -26,57 +27,53 @@ show-field="name" value-field="id" label="Province" - vn-acl="administrative" - > + vn-acl="administrative"> + vn-acl="administrative"> - + - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + vn-id="propagate-isEqualizated" + on-response="$ctrl.returnDialogEt(response)"> - You changes the equivalent tax - Do you want to spread the change to their consignees? + You changes the equivalen + Do you want to spread the change to their consig diff --git a/client/client/src/fiscal-data/fiscal-data.js b/client/client/src/fiscal-data/fiscal-data.js index 6ef3c3931..5fd10bf93 100644 --- a/client/client/src/fiscal-data/fiscal-data.js +++ b/client/client/src/fiscal-data/fiscal-data.js @@ -6,7 +6,7 @@ export default class ClientFiscalData { this.$http = $http; this.vnApp = vnApp; this.translate = $translate; - this.equalizationTax = undefined; + this.isEqualizated = undefined; this.copyData(); } @@ -16,7 +16,7 @@ export default class ClientFiscalData { copyData() { if (this.client) { - this.equalizationTax = this.client.equalizationTax; + this.isEqualizated = this.client.isEqualizated; } } @@ -26,16 +26,16 @@ export default class ClientFiscalData { } checkEtChanges() { - let equals = this.equalizationTax == this.client.equalizationTax; - this.equalizationTax = this.client.equalizationTax; + let equals = this.isEqualizated == this.client.isEqualizated; + this.isEqualizated = this.client.isEqualizated; if (!equals) - this.$.propagateEqualizationTax.show(); + this.$.propagateIsEqualizated.show(); } returnDialogEt(response) { if (response === 'ACCEPT') { - this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then( + this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then( res => { if (res.data) this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded')); diff --git a/client/client/src/fiscal-data/fiscal-data.spec.js b/client/client/src/fiscal-data/fiscal-data.spec.js new file mode 100644 index 000000000..653029c6f --- /dev/null +++ b/client/client/src/fiscal-data/fiscal-data.spec.js @@ -0,0 +1,31 @@ +import './fiscal-data.js'; + +describe('Client', () => { + describe('Component vnClientFiscalData', () => { + let $componentController; + let $httpBackend; + let $scope; + let controller; + + beforeEach(() => { + angular.mock.module('client'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => { + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $scope = $rootScope.$new(); + controller = $componentController('vnClientFiscalData', {$scope: $scope}); + })); + + describe('returnDialogEt()', () => { + it('should request to patch the propagation of tax status', () => { + controller.client = {id: 123, isEqualizated: false}; + $httpBackend.when('PATCH', `/client/api/Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); + $httpBackend.expectPATCH(`/client/api/Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}); + controller.returnDialogEt('ACCEPT'); + $httpBackend.flush(); + }); + }); + }); +}); diff --git a/client/client/src/greuge-create/greuge-create.html b/client/client/src/greuge-create/greuge-create.html new file mode 100644 index 000000000..2e8ed2454 --- /dev/null +++ b/client/client/src/greuge-create/greuge-create.html @@ -0,0 +1,36 @@ + + + + +
+ + + Add Greuge + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/client/client/src/greuge-create/greuge-create.js b/client/client/src/greuge-create/greuge-create.js new file mode 100644 index 000000000..3e8aa96a8 --- /dev/null +++ b/client/client/src/greuge-create/greuge-create.js @@ -0,0 +1,25 @@ +import ngModule from '../module'; + +class ClientGreugeCreate { + constructor($scope, $state, $filter) { + this.$ = $scope; + this.$state = $state; + this.greuge = { + shipped: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm') + }; + } + onSubmit() { + this.greuge.clientFk = this.$state.params.id; + this.$.watcher.submit().then( + () => { + this.$state.go('clientCard.greuge.list'); + } + ); + } +} +ClientGreugeCreate.$inject = ['$scope', '$state', '$filter']; + +ngModule.component('vnClientGreugeCreate', { + template: require('./greuge-create.html'), + controller: ClientGreugeCreate +}); diff --git a/client/client/src/greuge-create/greuge-create.spec.js b/client/client/src/greuge-create/greuge-create.spec.js new file mode 100644 index 000000000..1cc408088 --- /dev/null +++ b/client/client/src/greuge-create/greuge-create.spec.js @@ -0,0 +1,39 @@ +import './greuge-create.js'; + +describe('Client', () => { + describe('Component vnClientGreugeCreate', () => { + let $componentController; + let $scope; + let $state; + let controller; + + beforeEach(() => { + angular.mock.module('client'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => { + $componentController = _$componentController_; + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = { + submit: () => { + return { + then: callback => { + callback(); + } + }; + } + }; + controller = $componentController('vnClientGreugeCreate', {$scope: $scope}); + })); + + describe('onSubmit()', () => { + it('should call the function go() on $state to go to the greuges list', () => { + spyOn($state, 'go'); + controller.onSubmit(); + + expect(controller.$state.go).toHaveBeenCalledWith('clientCard.greuge.list'); + }); + }); + }); +}); diff --git a/client/client/src/greuge-list/greuge-list.html b/client/client/src/greuge-list/greuge-list.html new file mode 100644 index 000000000..22566ec66 --- /dev/null +++ b/client/client/src/greuge-list/greuge-list.html @@ -0,0 +1,36 @@ + + + + + Greuge + + + + + + + + + {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }} + {{::greuge.description}} + {{::greuge.amount | number:2}} € + {{::greuge.greugeType.name}} + + + No results + + + + {{edit.model.sumAmount | number:2}} € + + + + + + + + + \ No newline at end of file diff --git a/client/client/src/greuge-list/greuge-list.js b/client/client/src/greuge-list/greuge-list.js new file mode 100644 index 000000000..a2e5bd33a --- /dev/null +++ b/client/client/src/greuge-list/greuge-list.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import FilterClientList from '../filterClientList'; + +class ClientGreugeList extends FilterClientList {} + +ngModule.component('vnClientGreugeList', { + template: require('./greuge-list.html'), + controller: ClientGreugeList +}); diff --git a/client/client/src/greuge-list/locale/es.yml b/client/client/src/greuge-list/locale/es.yml new file mode 100644 index 000000000..5038e95d1 --- /dev/null +++ b/client/client/src/greuge-list/locale/es.yml @@ -0,0 +1,5 @@ +Date: Fecha +Comment: Comentario +Amount: Importe +Type: Tipo +Add Greuge: Añadir Greuge \ No newline at end of file diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html index 3556b7808..ba40c663b 100644 --- a/client/client/src/index/index.html +++ b/client/client/src/index/index.html @@ -3,12 +3,13 @@
- + popover="vn-client-search-panel" + ignore-keys = "['page', 'size', 'search']" + > diff --git a/client/client/src/index/index.js b/client/client/src/index/index.js index 38d9996ca..d07b12549 100644 --- a/client/client/src/index/index.js +++ b/client/client/src/index/index.js @@ -7,7 +7,6 @@ export default class Controller { this.model = {}; } search(index) { - index.filter.search = this.model.search; index.accept(); } } diff --git a/client/client/src/index/index.spec.js b/client/client/src/index/index.spec.js index 821cb4685..d1dd2532b 100644 --- a/client/client/src/index/index.spec.js +++ b/client/client/src/index/index.spec.js @@ -18,19 +18,19 @@ describe('Client', () => { expect(controller.model).toEqual({}); }); - describe('search()', () => { - it(`should set model's search to the search input`, () => { - controller.model.search = 'batman'; - let index = { - filter: {}, - accept: () => { - return 'accepted'; - } - }; - controller.search(index); + // describe('search()', () => { + // it(`should set model's search to the search input`, () => { + // controller.model.search = 'batman'; + // let index = { + // filter: {}, + // accept: () => { + // return 'accepted'; + // } + // }; + // controller.search(index); - expect(index.filter.search).toBe('batman'); - }); - }); + // expect(index.filter.search).toBe('batman'); + // }); + // }); }); }); diff --git a/client/client/src/index/item-client.html b/client/client/src/index/item-client.html index df64195b8..05cf2f614 100644 --- a/client/client/src/index/item-client.html +++ b/client/client/src/index/item-client.html @@ -1,7 +1,7 @@ - -
{{$ctrl.client.name}}
-
Client id: {{$ctrl.client.id}}
-
Phone: {{$ctrl.client.phone | phone}}
-
Town/City: {{$ctrl.client.city}}
-
Email: {{$ctrl.client.email}}
+
+
{{::$ctrl.client.name}}
+
Client id: {{::$ctrl.client.id}}
+
Phone: {{::$ctrl.client.phone | phone}}
+
Town/City: {{::$ctrl.client.city}}
+
Email: {{::$ctrl.client.email}}
diff --git a/client/client/src/index/locale/es.json b/client/client/src/index/locale/es.json deleted file mode 100644 index 8b063f658..000000000 --- a/client/client/src/index/locale/es.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Client id": "Id cliente", - "Phone": "Teléfono", - "Town/City": "Ciudad", - "Email": "Correo electrónico", - "Create client": "Crear cliente" -} \ No newline at end of file diff --git a/client/client/src/index/locale/es.yml b/client/client/src/index/locale/es.yml new file mode 100644 index 000000000..c221de7f6 --- /dev/null +++ b/client/client/src/index/locale/es.yml @@ -0,0 +1,5 @@ +Client id: Id cliente +Phone: Teléfono +Town/City: Ciudad +Email: Correo electrónico +Create client: Crear cliente \ No newline at end of file diff --git a/client/client/src/index/style.css b/client/client/src/index/style.css index b30351f09..123a0bf97 100644 --- a/client/client/src/index/style.css +++ b/client/client/src/index/style.css @@ -12,5 +12,5 @@ vn-item-client a:hover { } .vn-item-client-name { - font-family: raleway-bold; + font-family: vn-font-bold; } diff --git a/client/client/src/locale/en.json b/client/client/src/locale/en.json deleted file mode 100644 index 78e01b929..000000000 --- a/client/client/src/locale/en.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Client": "Client", - "Clients": "Clients" -} \ No newline at end of file diff --git a/client/client/src/locale/en.yml b/client/client/src/locale/en.yml new file mode 100644 index 000000000..3dec4a7ed --- /dev/null +++ b/client/client/src/locale/en.yml @@ -0,0 +1,2 @@ +Client: Client +Clients: Clients \ No newline at end of file diff --git a/client/client/src/locale/es.json b/client/client/src/locale/es.json deleted file mode 100644 index 20089e85c..000000000 --- a/client/client/src/locale/es.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "Client": "Cliente", - "Clients": "Clientes", - "Fiscal data": "Datos Fiscales", - "Has to invoice": "Factura", - "Invoice by mail": "Factura impresa", - "Country": "País", - "Street": "Domicilio fiscal", - "City": "Municipio", - "Postcode": "Código postal", - "Province": "Provincia", - "Save": "Guardar", - "Pay method" : "Forma de pago" -} diff --git a/client/client/src/locale/es.yml b/client/client/src/locale/es.yml new file mode 100644 index 000000000..bb2984d9b --- /dev/null +++ b/client/client/src/locale/es.yml @@ -0,0 +1,23 @@ +Active: Activo +Client: Cliente +Clients: Clientes +Basic data: Datos básicos +Fiscal data: Datos Fiscales +Addresses: Consignatarios +Web access: Acceso web +Notes: Notas +Has to invoice: Factura +Invoice by mail: Factura impresa +Country: País +Street: Domicilio fiscal +City: Municipio +Postcode: Código postal +Province: Provincia +Save: Guardar +Pay method : Forma de pago +Address: Consignatario +Credit : Crédito +Secured credit: Crédito asegurado +Verified data: Datos comprobados +Mandate: Mandato +Amount: Importe \ No newline at end of file diff --git a/client/client/src/mandate/locale/es.yml b/client/client/src/mandate/locale/es.yml new file mode 100644 index 000000000..545707023 --- /dev/null +++ b/client/client/src/mandate/locale/es.yml @@ -0,0 +1,3 @@ +Company: Empresa +Register date: Fecha alta +End date: Fecha baja \ No newline at end of file diff --git a/client/client/src/mandate/mandate.html b/client/client/src/mandate/mandate.html new file mode 100644 index 000000000..f129da64b --- /dev/null +++ b/client/client/src/mandate/mandate.html @@ -0,0 +1,31 @@ + + + + Mandate + + + + + + + + + + + {{::mandate.id}} + {{::mandate.company.code}} + {{::mandate.mandateType.name}} + {{::mandate.created | date:'dd/MM/yyyy HH:mm' }} + {{::mandate.finished | date:'dd/MM/yyyy HH:mm' || '-'}} + + + No results + + + + + \ No newline at end of file diff --git a/client/client/src/mandate/mandate.js b/client/client/src/mandate/mandate.js new file mode 100644 index 000000000..e48222ce6 --- /dev/null +++ b/client/client/src/mandate/mandate.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import FilterClientList from '../filterClientList'; + +ngModule.component('vnClientMandate', { + template: require('./mandate.html'), + controller: FilterClientList +}); diff --git a/client/client/src/note-create/locale/es.json b/client/client/src/note-create/locale/es.json deleted file mode 100644 index ed49b6323..000000000 --- a/client/client/src/note-create/locale/es.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "New note": "Nueva nota", - "Note": "Nota" -} \ No newline at end of file diff --git a/client/client/src/note-create/locale/es.yml b/client/client/src/note-create/locale/es.yml new file mode 100644 index 000000000..bfe773f48 --- /dev/null +++ b/client/client/src/note-create/locale/es.yml @@ -0,0 +1,2 @@ +New note: Nueva nota +Note: Nota \ No newline at end of file diff --git a/client/client/src/notes/locale/es.json b/client/client/src/notes/locale/es.json deleted file mode 100644 index 28b37f5a8..000000000 --- a/client/client/src/notes/locale/es.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Notes": "Notas" -} \ No newline at end of file diff --git a/client/client/src/notes/notes.html b/client/client/src/notes/notes.html index ecea1d668..0b29a5d7f 100644 --- a/client/client/src/notes/notes.html +++ b/client/client/src/notes/notes.html @@ -1,13 +1,19 @@ Notes - - -
{{::n.created | date:'dd/MM/yyyy HH:mm'}}
-
{{::n.employee.name}}
-
{{::n.text}}
-
-
+ + + {{::n.worker.firstName}} {{::n.worker.name}} + {{::n.created | date:'dd/MM/yyyy HH:mm'}} + + + {{::n.text}} + +
{ $componentController = _$componentController_; $state = _$state_; $httpBackend = _$httpBackend_; - controller = $componentController('vnClientNotes', {$httpBackend: $httpBackend, $state: $state}); + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); + controller = $componentController('vnClientNotes', {$state: $state}); })); describe('$onChanges()', () => { diff --git a/client/client/src/notes/style.css b/client/client/src/notes/style.css index 4d0f8eba7..e69de29bb 100644 --- a/client/client/src/notes/style.css +++ b/client/client/src/notes/style.css @@ -1,3 +0,0 @@ -.notes-date { - font-family: raleway-bold; -} \ No newline at end of file diff --git a/client/client/src/search-panel/locale/es.json b/client/client/src/search-panel/locale/es.json deleted file mode 100644 index 1dc7b850f..000000000 --- a/client/client/src/search-panel/locale/es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Client id": "Id cliente", - "Tax number": "NIF/CIF", - "Name": "Nombre", - "Social name": "Razon social", - "Town/City": "Ciudad", - "Postcode": "Código postal", - "Email": "Correo electrónico", - "Phone": "Teléfono" -} \ No newline at end of file diff --git a/client/client/src/search-panel/locale/es.yml b/client/client/src/search-panel/locale/es.yml new file mode 100644 index 000000000..590d0e6d8 --- /dev/null +++ b/client/client/src/search-panel/locale/es.yml @@ -0,0 +1,8 @@ +Client id: Id cliente +Tax number: NIF/CIF +Name: Nombre +Social name: Razon social +Town/City: Ciudad +Postcode: Código postal +Email: Correo electrónico +Phone: Teléfono \ No newline at end of file diff --git a/client/client/src/search-panel/search-panel.js b/client/client/src/search-panel/search-panel.js index 3f78dc809..74c4647ba 100644 --- a/client/client/src/search-panel/search-panel.js +++ b/client/client/src/search-panel/search-panel.js @@ -1,28 +1,16 @@ import ngModule from '../module'; export default class Controller { - constructor(sessionStorage) { - this.sessionStorage = sessionStorage; + constructor() { // onSubmit() is defined by @vnSearchbar this.onSubmit = () => {}; } onSearch() { - this.setStorageValue(); this.onSubmit(this.filter); } - - $onChanges() { - var value = this.sessionStorage.get('filter'); - if (value !== undefined) - this.filter = value; - } - - setStorageValue() { - this.sessionStorage.set('filter', this.filter); - } } -Controller.$inject = ['sessionStorage']; +Controller.$inject = []; ngModule.component('vnClientSearchPanel', { template: require('./search-panel.html'), diff --git a/client/client/src/search-panel/search-panel.spec.js b/client/client/src/search-panel/search-panel.spec.js deleted file mode 100644 index e4b7b5634..000000000 --- a/client/client/src/search-panel/search-panel.spec.js +++ /dev/null @@ -1,41 +0,0 @@ -import './search-panel.js'; - -describe('Client', () => { - describe('Component vnClientSearchPanel', () => { - let $componentController; - let sessionStorage; - let controller; - - beforeEach(() => { - angular.mock.module('client'); - }); - - beforeEach(angular.mock.inject((_$componentController_, _sessionStorage_) => { - $componentController = _$componentController_; - sessionStorage = _sessionStorage_; - controller = $componentController('vnClientSearchPanel', {sessionStorage: sessionStorage}); - })); - - describe('onSearch()', () => { - it('should call setStorageValue() and onSubmit()', () => { - spyOn(controller, 'setStorageValue'); - spyOn(controller, 'onSubmit'); - controller.setStorageValue(); - controller.onSubmit(); - - expect(controller.setStorageValue).toHaveBeenCalledWith(); - expect(controller.onSubmit).toHaveBeenCalledWith(); - }); - }); - - describe('$onChanges()', () => { - it('should set filter properties using the search values', () => { - expect(controller.filter).not.toBeDefined(); - spyOn(sessionStorage, 'get').and.returnValue({data: 'data'}); - controller.$onChanges(); - - expect(controller.filter).toBe(sessionStorage.get({data: 'data'})); - }); - }); - }); -}); diff --git a/client/client/src/web-access/locale/es.json b/client/client/src/web-access/locale/es.json deleted file mode 100644 index 82652f89f..000000000 --- a/client/client/src/web-access/locale/es.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "User": "Usuario", - "Enable web access": "Habilitar acceso web", - "Web access": "Acceso web", - "New password": "Nueva contraseña", - "Repeat password": "Repetir contraseña", - "Change password": "Cambiar contraseña" -} \ No newline at end of file diff --git a/client/client/src/web-access/locale/es.yml b/client/client/src/web-access/locale/es.yml new file mode 100644 index 000000000..2d1905c16 --- /dev/null +++ b/client/client/src/web-access/locale/es.yml @@ -0,0 +1,5 @@ +User: Usuario +Enable web access: Habilitar acceso web +New password: Nueva contraseña +Repeat password: Repetir contraseña +Change password: Cambiar contraseña \ No newline at end of file diff --git a/client/client/src/web-access/web-access.js b/client/client/src/web-access/web-access.js index 696d8a0ad..41aefc0bf 100644 --- a/client/client/src/web-access/web-access.js +++ b/client/client/src/web-access/web-access.js @@ -16,7 +16,7 @@ export default class Controller { isCustomer() { if (this.client && this.client.id) { - this.$http.get(`/client/api/Clients/${this.client.id}/getRoleCustomer`).then(res => { + this.$http.get(`/client/api/Clients/${this.client.id}/hasCustomerRole`).then(res => { this.canChangePassword = (res.data) ? res.data.isCustomer : false; }); } else { diff --git a/client/client/src/web-access/web-access.spec.js b/client/client/src/web-access/web-access.spec.js index 584ad58c1..a700f4c8b 100644 --- a/client/client/src/web-access/web-access.spec.js +++ b/client/client/src/web-access/web-access.spec.js @@ -15,6 +15,7 @@ describe('Component VnClientWebAccess', () => { $componentController = _$componentController_; $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); vnApp = _vnApp_; spyOn(vnApp, 'showError'); controller = $componentController('vnClientWebAccess', {$scope: $scope}); @@ -37,8 +38,8 @@ describe('Component VnClientWebAccess', () => { controller.client = {id: '1234'}; controller.isCustomer(); - $httpBackend.when('GET', `/client/api/Clients/${controller.client.id}/getRoleCustomer`).respond('ok'); - $httpBackend.expectGET(`/client/api/Clients/${controller.client.id}/getRoleCustomer`); + $httpBackend.when('GET', `/client/api/Clients/${controller.client.id}/hasCustomerRole`).respond('ok'); + $httpBackend.expectGET(`/client/api/Clients/${controller.client.id}/hasCustomerRole`); $httpBackend.flush(); }); }); diff --git a/client/core/package.json b/client/core/package.json deleted file mode 100644 index e85f98a47..000000000 --- a/client/core/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@salix/core", - "version": "0.0.0", - "description": "", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://git.verdnatura.es/salix" - } -} diff --git a/client/core/src/autocomplete/autocomplete.html b/client/core/src/autocomplete/autocomplete.html index 962798629..df78db6d9 100644 --- a/client/core/src/autocomplete/autocomplete.html +++ b/client/core/src/autocomplete/autocomplete.html @@ -1,6 +1,12 @@ - - - + + + {{$parent.item.name}} + parent = "$ctrl.element" + >{{$parent.item[$ctrl.showField]}} \ No newline at end of file diff --git a/client/core/src/autocomplete/autocomplete.js b/client/core/src/autocomplete/autocomplete.js index 853267592..528c8fadf 100644 --- a/client/core/src/autocomplete/autocomplete.js +++ b/client/core/src/autocomplete/autocomplete.js @@ -19,14 +19,15 @@ class Autocomplete extends Component { this._field = null; this._preLoad = false; this.maxRow = 10; - this.showField = this.showField || 'name'; - this.valueField = this.valueField || 'id'; - this.order = this.order || 'name ASC'; + this.showField = 'name'; + this.valueField = 'id'; this.items = copyObject(this.data) || []; this.displayValueMultiCheck = []; this._multiField = []; this.readonly = true; this.removeLoadMore = false; + this.form = null; + this.findForm = false; } get showDropDown() { @@ -87,6 +88,7 @@ class Autocomplete extends Component { if (this.multiple) { this.setMultiField(value[this.valueField]); } + this.setDirtyForm(); } else { this.setValue(value); } @@ -191,6 +193,10 @@ class Autocomplete extends Component { return fields; } + getOrder() { + return this.order ? this.order : `${this.showField} ASC`; + } + findItems(search) { if (this.url && search && !this.finding) { this.maxRow = false; @@ -204,7 +210,7 @@ class Autocomplete extends Component { Object.assign(filter.where, this.filter.where); } } - filter.order = this.order; + filter.order = this.getOrder(); let json = JSON.stringify(filter); this.finding = true; this.$http.get(`${this.url}?filter=${json}`).then( @@ -248,7 +254,7 @@ class Autocomplete extends Component { filter.skip = this.items.length; } filter.limit = this.maxRow; - filter.order = this.order; + filter.order = this.getOrder(); } if (this.filter) { Object.assign(filter, this.filter); @@ -284,6 +290,22 @@ class Autocomplete extends Component { } } } + _parentForm() { + this.findForm = true; + let formScope = this.$scope; + while (formScope && !formScope.form && formScope.$id > 1) { + formScope = formScope.$parent; + } + this.form = formScope ? formScope.form || null : null; + } + setDirtyForm() { + if (!this.form && !this.findForm) { + this._parentForm(); + } + if (this.form) { + this.form.$setDirty(); + } + } $onInit() { this.findMore = this.url && this.maxRow; diff --git a/client/core/src/autocomplete/autocomplete.spec.js b/client/core/src/autocomplete/autocomplete.spec.js index 7f8acb427..3425a84f2 100644 --- a/client/core/src/autocomplete/autocomplete.spec.js +++ b/client/core/src/autocomplete/autocomplete.spec.js @@ -16,6 +16,7 @@ describe('Component vnAutocomplete', () => { $componentController = _$componentController_; $scope = $rootScope.$new(); $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $timeout = _$timeout_; $element = angular.element('
'); controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}); @@ -120,7 +121,6 @@ describe('Component vnAutocomplete', () => { it(`should perform a query if the item id isn't present in the controller.items property`, () => { controller.url = 'test.com'; - $httpBackend.whenGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`).respond(); $httpBackend.expectGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`); controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}]; controller.field = 3; @@ -136,7 +136,6 @@ describe('Component vnAutocomplete', () => { it(`should set field performing a query as the item id isn't present in the controller.items property`, () => { controller.url = 'test.com'; - $httpBackend.whenGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`).respond(); $httpBackend.expectGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`); controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}]; controller.field = 3; @@ -150,7 +149,7 @@ describe('Component vnAutocomplete', () => { let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}); controller.url = 'test.com'; let search = 'The Joker'; - let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.order}); + let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.getOrder()}); $httpBackend.whenGET(`${controller.url}?filter=${json}`).respond([{id: 3, name: 'The Joker'}]); $httpBackend.expectGET(`${controller.url}?filter=${json}`); controller.findItems(search); @@ -163,8 +162,8 @@ describe('Component vnAutocomplete', () => { let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}); controller.url = 'test.com'; let search = 'The Joker'; - controller.filterSearch = "{where: {surname: {regexp: 'search'}}}"; - let json = JSON.stringify({where: {surname: {regexp: search}}, order: controller.order}); + controller.filterSearch = "{where: {name: {regexp: 'search'}}}"; + let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.getOrder()}); $httpBackend.whenGET(`${controller.url}?filter=${json}`).respond([{id: 3, name: 'The Joker'}]); $httpBackend.expectGET(`${controller.url}?filter=${json}`); controller.findItems(search); @@ -177,7 +176,7 @@ describe('Component vnAutocomplete', () => { controller.url = 'test.com'; let search = 'Joker'; controller.multiple = true; - let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.order}); + let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.getOrder()}); $httpBackend.whenGET(`${controller.url}?filter=${json}`).respond([{id: 3, name: 'The Joker'}, {id: 4, name: 'Joker'}]); $httpBackend.expectGET(`${controller.url}?filter=${json}`); controller.findItems(search); diff --git a/client/core/src/autocomplete/style.scss b/client/core/src/autocomplete/style.scss index 1472dbcf3..15e59d4d3 100644 --- a/client/core/src/autocomplete/style.scss +++ b/client/core/src/autocomplete/style.scss @@ -18,18 +18,23 @@ ul.vn-autocomplete { } &.load-more { color: #ffa410; - font-weight: bold; + font-family: vn-font-bold; padding: .4em .8em; } } } vn-autocomplete { + position: relative; + vn-vertical { + outline:none; + } + .mdl-chip__action { position: absolute; top: 0px; right: -6px; margin: 22px 0px; - background-color: white; + background: transparent; } .material-icons { font-size: 18px; diff --git a/client/core/src/column-header/column-header.html b/client/core/src/column-header/column-header.html index 435057a19..df0a4caee 100644 --- a/client/core/src/column-header/column-header.html +++ b/client/core/src/column-header/column-header.html @@ -1,11 +1,22 @@
- - - {{::$ctrl.text}} + + + {{::$ctrl.text}} - - - + + + diff --git a/client/core/src/column-header/column-header.js b/client/core/src/column-header/column-header.js index 2f5f4d3c3..51f990db6 100644 --- a/client/core/src/column-header/column-header.js +++ b/client/core/src/column-header/column-header.js @@ -1,19 +1,29 @@ import {module} from '../module'; export default class ColumnHeader { - constructor() { + constructor($attrs) { this.order = undefined; this.mouseIsOver = false; + this.orderLocked = ($attrs.orderLocked !== undefined); } - onClick() { - if (this.order === 'ASC') { - this.order = 'DESC'; - } else { - this.order = 'ASC'; + onClick(event, order) { + if (!this.orderLocked) { + if (order) { + this.order = order; + } else if (this.order === 'ASC') { + this.order = 'DESC'; + } else { + this.order = 'ASC'; + } + this.gridHeader.selectColum(this); } - this.gridHeader.selectColum(this); + if (event) + event.preventDefault(); } showArrow(type) { + if (this.orderLocked) + return false; + let showArrow = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order === type); let showOther = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order !== type); if (type === 'DESC' && this.mouseIsOver && !showOther) { @@ -22,13 +32,13 @@ export default class ColumnHeader { return showArrow; } $onInit() { - if (this.defaultOrder) { + if (this.defaultOrder && !this.orderLocked) { this.order = this.defaultOrder; this.onClick(); } } } -ColumnHeader.$inject = []; +ColumnHeader.$inject = ['$attrs']; module.component('vnColumnHeader', { template: require('./column-header.html'), diff --git a/client/core/src/column-header/column-header.spec.js b/client/core/src/column-header/column-header.spec.js index 5c6d29d73..2291094b3 100644 --- a/client/core/src/column-header/column-header.spec.js +++ b/client/core/src/column-header/column-header.spec.js @@ -3,6 +3,8 @@ import './column-header.js'; describe('Component vnColumnHeader', () => { let $componentController; let controller; + let $event; + let $attrs; beforeEach(() => { angular.mock.module('client'); @@ -10,14 +12,18 @@ describe('Component vnColumnHeader', () => { beforeEach(angular.mock.inject(_$componentController_ => { $componentController = _$componentController_; - controller = $componentController('vnColumnHeader', {}); + $event = { + preventDefault: () => {} + }; + $attrs = {}; + controller = $componentController('vnColumnHeader', {$attrs}); })); describe('onClick()', () => { it(`should change the ordenation to DESC (descendant) if it was ASC (ascendant)`, () => { controller.gridHeader = {selectColum: () => {}}; controller.order = 'ASC'; - controller.onClick(); + controller.onClick($event); expect(controller.order).toEqual('DESC'); }); @@ -25,7 +31,7 @@ describe('Component vnColumnHeader', () => { it(`should change the ordenation to ASC (ascendant) if it wasnt ASC`, () => { controller.gridHeader = {selectColum: () => {}}; controller.order = 'DESC or any other value that might occur'; - controller.onClick(); + controller.onClick($event); expect(controller.order).toEqual('ASC'); }); @@ -34,7 +40,7 @@ describe('Component vnColumnHeader', () => { controller.gridHeader = {selectColum: () => {}}; controller.order = 'Change me!'; spyOn(controller.gridHeader, 'selectColum'); - controller.onClick(); + controller.onClick($event); expect(controller.gridHeader.selectColum).toHaveBeenCalledWith(controller); }); diff --git a/client/core/src/confirm/style.css b/client/core/src/confirm/style.css index 7177560fd..b19288ecb 100644 --- a/client/core/src/confirm/style.css +++ b/client/core/src/confirm/style.css @@ -1,5 +1,5 @@ - -vn-confirm .dialog-title { - color:#424242; - font-family: raleway-bold; -} + +vn-confirm .dialog-title { + color:#424242; + font-family: vn-font-bold; +} diff --git a/client/core/src/datePicker/datePicker.html b/client/core/src/datePicker/datePicker.html index d91f0a53f..21839aa16 100644 --- a/client/core/src/datePicker/datePicker.html +++ b/client/core/src/datePicker/datePicker.html @@ -4,7 +4,8 @@ ng-focus="$ctrl.hasFocus = true" ng-blur="$ctrl.hasFocus = false" ng-mouseenter="$ctrl.hasMouseIn = true" - ng-mouseleave="$ctrl.hasMouseIn = false" + ng-mouseleave="$ctrl.hasMouseIn = false" + ng-click="$ctrl.onClick()" > { + this.model = value; + }, 250); + } else { + this.model = null; + this.modelView = ''; + this._waitingInit = 0; } } get modelView() { @@ -52,17 +77,23 @@ class DatePicker extends Component { this._modelView = value; this.input.value = value; this._setModel(value); - this.$timeout(() => { - this.mdlUpdate(); - }, 500); + this.mdlUpdate(); } + onClear() { this.modelView = null; } + onClick() { + if (this.vp) { + this.vp.open(); + } + } mdlUpdate() { - let mdlField = this.element.firstChild.MaterialTextfield; - if (mdlField) - mdlField.updateClasses_(); + this.$timeout(() => { + let mdlField = this.element.firstChild.MaterialTextfield; + if (mdlField) + mdlField.updateClasses_(); + }, 500); } _formatFlat2Angular(string) { // change string Flatpickr format to angular format (d-m-Y -> dd-MM-yyyy) @@ -83,54 +114,59 @@ class DatePicker extends Component { return parts.join('-'); } + _string2BackFormat(value) { + let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/); + let aux = value.split(/[ZT.,/ :-]/); + let date = {}; + formats.forEach( + (k, i) => { + if (k.toLowerCase() === 'y') { + date.year = aux[i]; + } else if (k === 'm' || k === 'n') { + date.month = aux[i]; + } else if (k === 'd' || k === 'j') { + date.day = aux[i]; + } else if (k.toLowerCase() === 'h') { + date.hour = aux[i]; + } else if (k === 'i') { + date.minutes = aux[i]; + } else if (k === 's') { + date.seccons = aux[i]; + } + } + ); + + let dateStr = ''; + let hourStr = ''; + + if (date.year && date.month && date.day) { + dateStr = `${date.year}-${date.month}-${date.day}`; + } + if (date.hour) { + hourStr = date.hour; + if (date.minutes) { + hourStr += ':' + date.minutes; + } else { + hourStr += ':00'; + } + if (date.seccons) { + hourStr += ':' + date.seccons; + } else { + hourStr += ':00'; + } + } + return `${dateStr} ${hourStr}`.trim(); + } + _setModel(value) { let model; + let options = this._getOptions(); if (!value) { model = undefined; - } else if (!this.iniOptions || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) { + } else if (!options || (options.dateFormat && options.dateFormat.startsWith('Y-m-d'))) { model = value; } else { - let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/); - let aux = value.split(/[ZT.,/ :-]/); - let date = {}; - formats.forEach( - (k, i) => { - if (k.toLowerCase() === 'y') { - date.year = aux[i]; - } else if (k === 'm' || k === 'n') { - date.month = aux[i]; - } else if (k === 'd' || k === 'j') { - date.day = aux[i]; - } else if (k.toLowerCase() === 'h') { - date.hour = aux[i]; - } else if (k === 'i') { - date.minutes = aux[i]; - } else if (k === 's') { - date.seccons = aux[i]; - } - } - ); - - let dateStr = ''; - let hourStr = ''; - - if (date.year && date.month && date.day) { - dateStr = `${date.year}-${date.month}-${date.day}`; - } - if (date.hour) { - hourStr = date.hour; - if (date.minutes) { - hourStr += ':' + date.minutes; - } else { - hourStr += ':00'; - } - if (date.seccons) { - hourStr += ':' + date.seccons; - } else { - hourStr += ':00'; - } - } - model = `${dateStr} ${hourStr}`.trim(); + model = this._string2BackFormat(value); } if (this.model !== model) { @@ -148,8 +184,8 @@ class DatePicker extends Component { if (!this.iniOptions.locale) this.iniOptions.locale = this.$translate.use(); - if (!this.iniOptions.dateFormat && this.iniOptions.locale === 'es') - this.iniOptions.dateFormat = 'd-m-Y'; + if (!this.iniOptions.dateFormat) + this.iniOptions.dateFormat = this.iniOptions.locale === 'es' ? 'd-m-Y' : 'Y-m-d'; else if (this.iniOptions.dateFormat) { let format = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/); if (format.length <= 1) { @@ -163,21 +199,44 @@ class DatePicker extends Component { } ); } + + if (this.$attrs.hasOwnProperty('today')) { + this.iniOptions.defaultDate = new Date(); + } + this._optionsChecked = true; return this.iniOptions; } - $onInit() { + initPicker() { this.iniOptions = this._getOptions(); this.isTimePicker = (this.iniOptions && this.iniOptions.enableTime && this.iniOptions.noCalendar); this.vp = new Flatpickr(this.input, this.iniOptions); + if (this.iniOptions.defaultDate) { + this.modelView = this.vp.formatDate(this.iniOptions.defaultDate, this.iniOptions.dateFormat); + } } - $onDestroy() { + destroyPicker() { if (this.vp) this.vp.destroy(); + this.vp = undefined; + } + + $onChanges(objChange) { + if (objChange.iniOptions && objChange.iniOptions.currentValue) { + this.iniOptions = Object.assign(this.iniOptions, objChange.iniOptions.currentValue); + } + } + + $onInit() { + this.initPicker(); + } + + $onDestroy() { + this.destroyPicker(); } } -DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout']; +DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout', '$attrs']; module.component('vnDatePicker', { template: require('./datePicker.html'), diff --git a/client/core/src/datePicker/datePicker.spec.js b/client/core/src/datePicker/datePicker.spec.js index bd0807dd7..05ff49d4f 100644 --- a/client/core/src/datePicker/datePicker.spec.js +++ b/client/core/src/datePicker/datePicker.spec.js @@ -2,9 +2,10 @@ import './datePicker.js'; describe('Component vnDatePicker', () => { let $componentController; - let $scope; + let $filter; let $timeout; let $element; + let $attrs; let $translate; let controller; @@ -12,13 +13,14 @@ describe('Component vnDatePicker', () => { angular.mock.module('client'); }); - beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$timeout_, _$translate_) => { + beforeEach(angular.mock.inject((_$componentController_, _$filter_, _$timeout_, _$translate_) => { $componentController = _$componentController_; - $scope = $rootScope.$new(); + $filter = _$filter_; $timeout = _$timeout_; $element = angular.element(`
`); $translate = _$translate_; - controller = $componentController('vnDatePicker', {$scope, $element, $translate, $timeout}); + $attrs = {}; + controller = $componentController('vnDatePicker', {$element, $translate, $filter, $timeout, $attrs}); })); describe('_formatFlat2Angular()', () => { @@ -36,6 +38,7 @@ describe('Component vnDatePicker', () => { it(`should split the given string into parts`, () => { controller.iniOptions = {dateFormat: 'd/m/Y'}; + controller._optionsChecked = true; controller.model = '2017-12-23'; expect(controller.modelView).toBe('23-12-2017'); diff --git a/client/core/src/dialog/style.scss b/client/core/src/dialog/style.scss index 1b30f5e98..73bd5ba19 100644 --- a/client/core/src/dialog/style.scss +++ b/client/core/src/dialog/style.scss @@ -1,68 +1,68 @@ -.vn-dialog { - display: none; - z-index: 100; - position: fixed; - left: 0; - top: 0; - height: 100%; - width: 100%; - background-color: rgba(1,1,1,.4); - - button.close { - position: absolute; - top: 0; - right: 0; - border-style: none; - background-color: transparent; - padding: .3em; - cursor: pointer; - - vn-icon { - display: block; - - i { - display: block; - } - } - - &:hover { - background-color: rgba(0, 0, 0, .1); - } - } - & > div { - position: relative; - box-shadow: 0 0 .4em rgba(1,1,1,.4); - background-color: white; - border-radius: .2em; - overflow: auto; - top: 50%; - left: 50%; - padding: 2em; - box-sizing: border-box; - - width: 28em; - margin-top: -10em; - margin-left: -14em; - } - .button-bar { - margin-top: 1.5em; - text-align: right; - - button { - background: none; - border: none; - text-transform: uppercase; - font-size: 1.1em; - color: #ffa410; - font-weight: bold; - cursor: pointer; - padding: .5em; - margin: -0.5em; - margin-left: .5em; - - &:hover { - background-color: rgba(1,1,1,.1); - } - } - } -} +.vn-dialog { + display: none; + z-index: 100; + position: fixed; + left: 0; + top: 0; + height: 100%; + width: 100%; + background-color: rgba(1,1,1,.4); + + button.close { + position: absolute; + top: 0; + right: 0; + border-style: none; + background-color: transparent; + padding: .3em; + cursor: pointer; + + vn-icon { + display: block; + + i { + display: block; + } + } + + &:hover { + background-color: rgba(0, 0, 0, .1); + } + } + & > div { + position: relative; + box-shadow: 0 0 .4em rgba(1,1,1,.4); + background-color: white; + border-radius: .2em; + overflow: auto; + top: 50%; + left: 50%; + padding: 2em; + box-sizing: border-box; + + width: 28em; + margin-top: -10em; + margin-left: -14em; + } + .button-bar { + margin-top: 1.5em; + text-align: right; + + button { + background: none; + border: none; + text-transform: uppercase; + font-size: 1.1em; + color: #ffa410; + font-family: vn-font-bold; + cursor: pointer; + padding: .5em; + margin: -0.5em; + margin-left: .5em; + + &:hover { + background-color: rgba(1,1,1,.1); + } + } + } +} diff --git a/client/core/src/directives/acl.js b/client/core/src/directives/acl.js index 362dad65d..f29142e1f 100644 --- a/client/core/src/directives/acl.js +++ b/client/core/src/directives/acl.js @@ -1,6 +1,25 @@ import {module} from '../module'; function vnAcl(aclService, $timeout) { + function getMaterialType(className) { + let type = ''; + if (className) { + type = className.replace('mdl-', '').replace('__input', ''); + type = type.charAt(0).toUpperCase() + type.slice(1); + } + return type; + } + function udateMaterial(input) { + if (input && input.className) { + let find = input.className.match(/mdl-[\w]+input/g); + if (find && find.length && find[0]) { + let type = getMaterialType(find[0]); + if (type && input.parentNode[`Material${type}`] && input.parentNode[`Material${type}`].updateClasses_) { + input.parentNode[`Material${type}`].updateClasses_(); + } + } + } + } return { restrict: 'A', priority: -1, @@ -18,6 +37,7 @@ function vnAcl(aclService, $timeout) { if (input) { $timeout(() => { input.setAttribute("disabled", "true"); + udateMaterial(input); }); $element[0].querySelectorAll('i, vn-drop-down').forEach(element => { element.parentNode.removeChild(element); diff --git a/client/core/src/directives/index.js b/client/core/src/directives/index.js index 4bd512eb0..67093faa8 100644 --- a/client/core/src/directives/index.js +++ b/client/core/src/directives/index.js @@ -3,3 +3,4 @@ import './focus'; import './dialog'; import './validation'; import './acl'; +import './onErrorSrc'; diff --git a/client/core/src/directives/onErrorSrc.js b/client/core/src/directives/onErrorSrc.js new file mode 100644 index 000000000..fd3cf2b82 --- /dev/null +++ b/client/core/src/directives/onErrorSrc.js @@ -0,0 +1,17 @@ +import {module} from '../module'; + +function onErrorSrc() { + return { + restrict: 'A', + link: (scope, element, attrs) => { + let imgError = '/static/images/no-image200x200.png'; + element.bind('error', function() { + if (attrs.src != imgError) { + attrs.$set('src', imgError); + } + }); + } + }; +} + +module.directive('onErrorSrc', onErrorSrc); diff --git a/client/core/src/directives/specs/acl.spec.js b/client/core/src/directives/specs/acl.spec.js index 615de5146..a8c1afc42 100644 --- a/client/core/src/directives/specs/acl.spec.js +++ b/client/core/src/directives/specs/acl.spec.js @@ -9,7 +9,8 @@ describe('Directive acl', () => { }); compile = (hasPermissions, _element) => { - inject(($compile, $rootScope, aclService, _$timeout_) => { + inject(($compile, $rootScope, aclService, _$timeout_, _$httpBackend_) => { + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); spyOn(aclService, 'aclPermission').and.returnValue(hasPermissions); scope = $rootScope.$new(); $timeout = _$timeout_; diff --git a/client/core/src/directives/specs/dialog.spec.js b/client/core/src/directives/specs/dialog.spec.js index 38d4ed9e2..f2d20ae0e 100644 --- a/client/core/src/directives/specs/dialog.spec.js +++ b/client/core/src/directives/specs/dialog.spec.js @@ -20,8 +20,9 @@ describe('Directive dialog', () => { }); }; - beforeEach(angular.mock.inject(_$componentController_ => { + beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_) => { $componentController = _$componentController_; + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $element = angular.element('
'); controller = $componentController('vnDialog', {$element}); })); diff --git a/client/core/src/directives/specs/focus.spec.js b/client/core/src/directives/specs/focus.spec.js index f610e9ffb..6b13c98a3 100644 --- a/client/core/src/directives/specs/focus.spec.js +++ b/client/core/src/directives/specs/focus.spec.js @@ -8,12 +8,11 @@ describe('Directive focus', () => { }); compile = (_element, _childElement) => { - inject(($compile, $rootScope) => { + inject(($compile, $rootScope, _$httpBackend_) => { $scope = $rootScope.$new(); + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $element = angular.element(_element); if (_childElement) { - let childElement = angular.element(_childElement); - $element[0] < childElement; $element[0].firstChild.focus = jasmine.createSpy(focus); } $element[0].focus = jasmine.createSpy('focus'); diff --git a/client/core/src/directives/specs/id.spec.js b/client/core/src/directives/specs/id.spec.js index 5755d1ea9..5c6fb0baa 100644 --- a/client/core/src/directives/specs/id.spec.js +++ b/client/core/src/directives/specs/id.spec.js @@ -8,8 +8,9 @@ describe('Directive vnId', () => { }); compile = _element => { - inject(($compile, $rootScope) => { + inject(($compile, $rootScope, _$httpBackend_) => { $scope = $rootScope.$new(); + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $element = angular.element(_element); $compile($element)($scope); $scope.$digest(); diff --git a/client/core/src/directives/specs/validation.spec.js b/client/core/src/directives/specs/validation.spec.js index e69de29bb..26208e34b 100644 --- a/client/core/src/directives/specs/validation.spec.js +++ b/client/core/src/directives/specs/validation.spec.js @@ -0,0 +1,187 @@ +describe('Directive validation', () => { + let scope; + let element; + let compile; + + beforeEach(() => { + angular.mock.module('client'); + }); + + compile = (_element, validations, value) => { + inject(($compile, $rootScope, aclService, _$timeout_, $window, _$httpBackend_) => { + $window.validations = validations; + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); + scope = $rootScope.$new(); + scope.user = {name: value}; + element = angular.element(_element); + $compile(element)(scope); + scope.$digest(); + }); + }; + + it(`should throw an error if the vnValidation doesn't have the right syntax`, () => { + let html = ``; + + expect(() => { + compile(html, {}); + }).toThrow(new Error(`vnValidation: Attribute must have this syntax: [entity].[field]`)); + }); + + it('should throw an error if the window.validations aint defined', () => { + let html = ``; + + expect(() => { + compile(html, {}); + }).toThrow(new Error(`vnValidation: Entity 'User' doesn't exist`)); + }); + + describe('Validator presence()', () => { + it('should not validate the user name as it is an empty string', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'presence'}]}}}; + compile(html, validations, 'Spiderman'); + scope.user.name = ''; + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + }); + + describe('Validator absence()', () => { + it('should not validate the entity as it should be an empty string', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'absence'}]}}}; + compile(html, validations, 'Spiderman'); + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + + it('should validate the entity as it is an empty string', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'absence'}]}}}; + compile(html, validations, ''); + scope.$digest(); + + expect(element[0].classList).toContain('ng-valid'); + expect(element[0].classList).not.toContain('ng-invalid'); + }); + }); + + describe('Validator length()', () => { + it('should not validate the user name as it should have min length of 15', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'length', min: 10, max: 50, is: 15}]}}}; + compile(html, validations, 'fifteen!'); + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + + it('should validate the user name as it has length of 15', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'length', min: 10, max: 50, is: 15}]}}}; + compile(html, validations, 'fifteen length!'); + scope.$digest(); + + expect(element[0].classList).toContain('ng-valid'); + expect(element[0].classList).not.toContain('ng-invalid'); + }); + + it('should not validate the user name as it should have min length of 10', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'length', min: 10}]}}}; + compile(html, validations, 'shortname'); + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + + it('should validate the user name as its length is greater then the minimum', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'length', min: 10}]}}}; + compile(html, validations, 'verylongname'); + scope.$digest(); + + expect(element[0].classList).toContain('ng-valid'); + expect(element[0].classList).not.toContain('ng-invalid'); + }); + + it('should not validate the user name as its length is greater then the maximum', () => { + let html = `
`; + let validations = {User: {validations: {name: [{validation: 'length', max: 10}]}}}; + compile(html, validations, 'toolongname'); + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + }); + + describe('Validator numericality()', () => { + it('should not validate the phone number as it should a integer', () => { + let html = `
`; + let validations = {User: {validations: {phone: [{validation: 'numericality', is: 'what is this?'}]}}}; + compile(html, validations, 'spiderman'); + scope.user.phone = 'this is not a phone number!'; + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + + it('should validate the phone number as it an integer', () => { + let html = `
`; + let validations = {User: {validations: {phone: [{validation: 'numericality', is: 'what is this?'}]}}}; + compile(html, validations, 'spiderman'); + scope.user.phone = '555555555'; + scope.$digest(); + + expect(element[0].classList).toContain('ng-valid'); + expect(element[0].classList).not.toContain('ng-invalid'); + }); + }); + + describe('Validator inclusion()', () => { + it('should not validate the phone number as it is not an integer', () => { + let html = `
`; + let validations = {User: {validations: {phone: [{validation: 'inclusion'}]}}}; + compile(html, validations, 'spiderman'); + scope.user.phone = 'this is not a phone number!'; + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + }); + + describe('Validator exclusion()', () => { + it('should validate the phone number as it is an integer', () => { + let html = `
`; + let validations = {User: {validations: {phone: [{validation: 'exclusion'}]}}}; + compile(html, validations, 'spiderman'); + scope.user.phone = '555555555'; + scope.$digest(); + + expect(element[0].classList).toContain('ng-valid'); + expect(element[0].classList).not.toContain('ng-invalid'); + }); + }); + + describe('Validator format()', () => { + it('should not validate the email number as it doesnt contain @', () => { + let html = `
`; + let validations = {User: {validations: {email: [{validation: 'format', with: '@'}]}}}; + compile(html, validations, 'spiderman'); + scope.user.email = 'userverdnatura.es'; + scope.$digest(); + + expect(element[0].classList).toContain('ng-invalid'); + expect(element[0].classList).not.toContain('ng-valid'); + }); + }); +}); diff --git a/client/core/src/directives/validation.js b/client/core/src/directives/validation.js index cd3878d9e..09c4a9f8e 100644 --- a/client/core/src/directives/validation.js +++ b/client/core/src/directives/validation.js @@ -29,7 +29,6 @@ export function directive(interpolate, compile, $window) { throw new Error(`vnValidation: Entity '${entityName}' doesn't exist`); let validations = entity.validations[fieldName]; - if (!validations || validations.length == 0) return; @@ -40,7 +39,7 @@ export function directive(interpolate, compile, $window) { let errorShown = false; input.$options.$$options.allowInvalid = true; - input.$validators.entity = function(value) { + input.$validators.entity = value => { try { validateAll(value, validations); return true; @@ -51,9 +50,9 @@ export function directive(interpolate, compile, $window) { } }; - scope.$watch(function() { + scope.$watch(() => { return (form.$submitted || input.$dirty) && input.$invalid; - }, function(value) { + }, value => { let parent = element.parent(); if (value) { diff --git a/client/core/src/drop-down/drop-down.html b/client/core/src/drop-down/drop-down.html index 9bab06069..e155c67af 100644 --- a/client/core/src/drop-down/drop-down.html +++ b/client/core/src/drop-down/drop-down.html @@ -1,13 +1,13 @@ - - + + - - + + - + \ No newline at end of file diff --git a/client/core/src/drop-down/drop-down.js b/client/core/src/drop-down/drop-down.js index 90a02e857..5a3666651 100644 --- a/client/core/src/drop-down/drop-down.js +++ b/client/core/src/drop-down/drop-down.js @@ -1,5 +1,6 @@ import {module} from '../module'; import './style.scss'; +import validKey from '../lib/keyCodes'; export default class DropDown { constructor($element, $filter, $timeout) { @@ -7,26 +8,36 @@ export default class DropDown { this.$filter = $filter; this.$timeout = $timeout; - this.parent = this.parent || $element[0].parentNode; this._search = null; this.itemsFiltered = []; this._activeOption = -1; this._focusingFilter = false; + this._tryToShow = 0; } + + get container() { + return this.$element[0].querySelector('ul.dropdown'); + } + get show() { return this._show; } set show(value) { let oldValue = this.show; - this._show = value; - if (value && !this._focusingFilter && oldValue !== value && this.filter) { - let inputFilterSearch = this.$element[0].querySelector('input'); - this._focusingFilter = true; + // It wait up to 1 second if the dropdown opens but there is no data to show + if (value && !oldValue && !this.itemsFiltered.length && this._tryToShow < 4) { this.$timeout(() => { - inputFilterSearch.focus(); - this._focusingFilter = false; + this._tryToShow++; + this.show = true; + if (this.activeOption === -1) { + this.activeOption = 0; + } }, 250); + } else { + this._tryToShow = 0; + this._show = value; + this._toggleDropDown(value, oldValue); } } @@ -51,18 +62,92 @@ export default class DropDown { set activeOption(value) { if (value < 0) { value = 0; - } else if (value >= this.items.length) { - value = this.showLoadMore ? this.items.length : this.items.length - 1; + } else if (value >= this.itemsFiltered.length) { + value = this.showLoadMore ? this.itemsFiltered.length : this.itemsFiltered.length - 1; } this.$timeout(() => { this._activeOption = value; - // AutoLoad items with "scroll" (1st version): - if (value && value >= this.items.length - 3 && !this.removeLoadMore) { + if (value && value >= this.itemsFiltered.length - 3 && !this.removeLoadMore) { this.loadItems(); } }); } + _toggleDropDown(value, oldValue) { + this.$timeout(() => { + this._eventScroll(value); + this._calculatePosition(value, oldValue); + }); + } + + _eventScroll(add, num) { + let count = num || 0; + if (add) { + if (this.container) { + this.container.addEventListener('scroll', e => this.loadFromScroll(e)); + // this.$timeout(() => { // falla al entrar por primera vez xq pierde el foco y cierra el dropdown + // this._setFocusInFilterInput(); + // }); + } else if (count < 4) { + count++; + this.$timeout(() => { // wait angular ngIf + this._eventScroll(add, count); + }, 250); + } + } else if (this.container) { + this.container.removeEventListener('scroll', e => this.loadFromScroll(e)); + } + } + + _setFocusInFilterInput() { + let inputFilterSearch = this.$element[0].querySelector('input'); + this._focusingFilter = true; + if (inputFilterSearch) + this.$timeout(() => { + inputFilterSearch.focus(); + this._focusingFilter = false; + }, 250); + } + + _background(create) { + let el = document.getElementById('ddBack'); + if (el) { + el.parentNode.removeChild(el); + } + + if (create) { + el = document.createElement('div'); + el.id = 'ddBack'; + document.body.appendChild(el); + } + } + _calculatePosition(value, oldValue) { + if (value && !oldValue) { + if (this.parent === undefined) { + this.parent = this.$element.parent().parent(); + } + + let parentRect = this.parent.getBoundingClientRect(); + let elemetRect = this.$element[0].getBoundingClientRect(); + let instOffset = parentRect.bottom + elemetRect.height; + + if (instOffset >= window.innerHeight) { + this._background(true); + this.$element.addClass('fixed-dropDown'); + this.$element.css('top', `${(parentRect.top - elemetRect.height)}px`); + this.$element.css('left', `${(parentRect.x)}px`); + this.$element.css('height', `${elemetRect.height}px`); + } + } else if (!value && oldValue) { + this.$element.removeAttr('style'); + if (this.itemWidth) { + this.$element.css('width', this.itemWidth + 'px'); + } + this.$element.removeClass('fixed-dropDown'); + this._background(); + } + } + filterItems() { this.itemsFiltered = this.search ? this.$filter('filter')(this.items, this.search) : this.items; } @@ -73,18 +158,6 @@ export default class DropDown { } } - $onChanges(changesObj) { - if (changesObj.show && changesObj.top && changesObj.top.currentValue) { - this.$element.css('top', changesObj.top.currentValue + 'px'); - } - if (changesObj.show && changesObj.itemWidth && changesObj.itemWidth.currentValue) { - this.$element.css('width', changesObj.itemWidth.currentValue + 'px'); - } - if (changesObj.items) { - this.filterItems(); - } - } - clearSearch() { this.search = null; } @@ -101,42 +174,55 @@ export default class DropDown { onKeydown(event) { if (this.show) { - switch (event.keyCode) { - case 13: // Enter + if (event.keyCode === 13) { // Enter this.$timeout(() => { this.selectOption(); }); event.preventDefault(); - break; - case 27: // Escape + } else if (event.keyCode === 27) { // Escape this.clearSearch(); - break; - case 38: // Arrow up + } else if (event.keyCode === 38) { // Arrow up this.activeOption--; this.$timeout(() => { this.setScrollPosition(); }, 100); - break; - case 40: // Arrow down + } else if (event.keyCode === 40) { // Arrow down this.activeOption++; this.$timeout(() => { this.setScrollPosition(); }, 100); - break; - default: - return; + } else if (event.keyCode === 35) { // End + this.activeOption = this.itemsFiltered.length - 1; + this.$timeout(() => { + this.setScrollPosition(); + }, 100); + } else if (event.keyCode === 36) { // Start + this.activeOption = 0; + this.$timeout(() => { + this.setScrollPosition(); + }, 100); + } else if (this.filter) { + let oldValue = this.search || ''; + if (validKey(event)) { + this.search = oldValue + String.fromCharCode(event.keyCode); + } else if (event.keyCode === 8) { // backSpace + this.search = oldValue.slice(0, -1); + } + } /* else { + console.error(`Error: keyCode ${event.keyCode} not supported`); + } */ + } + } + setScrollPosition() { + let child = this.$element[0].querySelector('ul.dropdown li.active'); + if (child) { + let childRect = child.getBoundingClientRect(); + let containerRect = this.container.getBoundingClientRect(); + if (typeof child.scrollIntoView === 'function' && (childRect.top > containerRect.top + containerRect.height || childRect.top < containerRect.top)) { + child.scrollIntoView(); } } } - - setScrollPosition() { - let dropdown = this.$element[0].querySelector('ul.dropdown'); - let child = dropdown ? dropdown.childNodes[this.activeOption] : null; - if (child && typeof child.scrollIntoView === 'function') { - child.scrollIntoView(); - } - } - selectItem(item) { this.selected = item; if (this.multiple) { @@ -146,14 +232,26 @@ export default class DropDown { this.show = false; } } - loadItems() { if (this.showLoadMore && this.loadMore) { this.loadMore(); } this.show = true; } - + loadFromScroll(e) { + let containerRect = e.target.getBoundingClientRect(); + if (e.target.scrollHeight - e.target.scrollTop - containerRect.height <= 50) { + this.loadItems(); + } + } + $onChanges(changesObj) { + if (changesObj.show && changesObj.itemWidth && changesObj.itemWidth.currentValue) { + this.$element.css('width', changesObj.itemWidth.currentValue + 'px'); + } + if (changesObj.items) { + this.filterItems(); + } + } $onInit() { if (this.parent) this.parent.addEventListener('keydown', e => this.onKeydown(e)); @@ -179,7 +277,6 @@ module.component('vnDropDown', { removeLoadMore: ' { angular.mock.module('client'); }); - beforeEach(angular.mock.inject((_$componentController_, _$timeout_, _$filter_) => { + beforeEach(angular.mock.inject((_$componentController_, _$timeout_, _$filter_, _$httpBackend_) => { + _$httpBackend_.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $componentController = _$componentController_; $element = angular.element('
'); $timeout = _$timeout_; $filter = _$filter_; controller = $componentController('vnDropDown', {$element, $timeout, $filter}); + controller.parent = angular.element('')[0]; })); describe('show() setter', () => { @@ -62,43 +64,43 @@ describe('Component vnDropDown', () => { it(`should set _activeOption as items.length if showLoadMore is defined if activeOption is bigger than items.length then call loadItems()`, () => { spyOn(controller, 'loadItems'); controller.showLoadMore = true; - controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; controller.activeOption = 10; $timeout.flush(); - expect(controller._activeOption).toEqual(4); + expect(controller.activeOption).toEqual(4); expect(controller.loadItems).toHaveBeenCalledWith(); }); it(`should set _activeOption as activeOption if showLoadMore is defined if activeOption is smaller than items.length then call loadItems()`, () => { spyOn(controller, 'loadItems'); controller.showLoadMore = true; - controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; controller.activeOption = 2; $timeout.flush(); - expect(controller._activeOption).toEqual(2); + expect(controller.activeOption).toEqual(2); expect(controller.loadItems).toHaveBeenCalledWith(); }); it(`should set _activeOption as items.length -1 if showLoadMore is not defined then call loadItems()`, () => { spyOn(controller, 'loadItems'); controller.showLoadMore = undefined; - controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; controller.activeOption = 10; $timeout.flush(); - expect(controller._activeOption).toEqual(3); + expect(controller.activeOption).toEqual(3); expect(controller.loadItems).toHaveBeenCalledWith(); }); it(`should define _activeOption as activeOption and never call loadItems()`, () => { spyOn(controller, 'loadItems'); - controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}, {id: 5, name: 'Doctor X'}]; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}, {id: 5, name: 'Doctor X'}]; controller.activeOption = 1; $timeout.flush(); - expect(controller._activeOption).toEqual(1); + expect(controller.activeOption).toEqual(1); expect(controller.loadItems).not.toHaveBeenCalledWith(); }); }); @@ -139,14 +141,6 @@ describe('Component vnDropDown', () => { }); describe('$onChanges()', () => { - it(`should set the top css of the $element`, () => { - let argumentObject = {show: true, top: {currentValue: 100}}; - spyOn(controller.$element, 'css'); - controller.$onChanges(argumentObject); - - expect(controller.$element.css).toHaveBeenCalledWith('top', '100px'); - }); - it(`should set the width css of the $element`, () => { let argumentObject = {show: true, itemWidth: {currentValue: 100}}; spyOn(controller.$element, 'css'); @@ -235,7 +229,7 @@ describe('Component vnDropDown', () => { }); it(`should call clearSearch() Esc key is pressed and take off 1 from _activeOption`, () => { - controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; spyOn(controller, 'setScrollPosition'); controller._show = true; controller.element = document.createElement('div'); @@ -250,7 +244,7 @@ describe('Component vnDropDown', () => { }); it(`should call clearSearch() Esc key is pressed and add up 1 to _activeOption`, () => { - controller.items = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; spyOn(controller, 'setScrollPosition'); controller._show = true; controller.element = document.createElement('div'); @@ -268,7 +262,11 @@ describe('Component vnDropDown', () => { describe('setScrollPosition()', () => { it(`should call child.scrollIntoView if defined `, () => { $element[0].firstChild.setAttribute('class', 'dropdown'); + $element[0].firstChild.firstChild.setAttribute('class', 'active'); let child = $element[0].firstChild.firstChild; + spyOn(child, 'getBoundingClientRect').and.returnValue({top: 100}); + let container = $element[0].firstChild; + spyOn(container, 'getBoundingClientRect').and.returnValue({top: 10, height: 70}); child.scrollIntoView = () => {}; spyOn(child, 'scrollIntoView'); controller._activeOption = 0; @@ -293,26 +291,40 @@ describe('Component vnDropDown', () => { controller.selectItem(item); expect(controller.selected).toEqual(item); - expect(controller._show).toEqual(true); + expect(controller._show).not.toBeDefined(); }); }); describe('loadItems()', () => { - it(`should set controller._show to true`, () => { + it(`should set controller.show to true`, () => { + controller.show = false; + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; controller.loadItems(); - expect(controller._show).toEqual(true); + expect(controller.show).toEqual(true); }); - it(`should call loadMore() and then set controller._show to true`, () => { + it(`should call loadMore() and then set controller._show to true if there are items`, () => { controller.showLoadMore = () => {}; controller.loadMore = () => {}; spyOn(controller, 'loadMore'); + controller.itemsFiltered = [{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce'}, {id: 3, name: 'Logan'}, {id: 4, name: 'Wolverine'}]; controller.loadItems(); expect(controller._show).toEqual(true); expect(controller.loadMore).toHaveBeenCalledWith(); }); + + it(`should call loadMore() and then set controller._show to undefined if there are not items`, () => { + controller.showLoadMore = () => {}; + controller.loadMore = () => {}; + spyOn(controller, 'loadMore'); + controller.itemsFiltered = []; + controller.loadItems(); + + expect(controller._show).not.toBeDefined(); + expect(controller.loadMore).toHaveBeenCalledWith(); + }); }); describe('$onInit()', () => { diff --git a/client/core/src/drop-down/style.scss b/client/core/src/drop-down/style.scss index e65fd4e6e..d4c28f734 100644 --- a/client/core/src/drop-down/style.scss +++ b/client/core/src/drop-down/style.scss @@ -4,6 +4,8 @@ vn-drop-down { padding: 0 15px; margin-left: -15px; background: transparent; + max-height: 446px; + overflow: hidden; .dropdown-body{ background: white; border: 1px solid #A7A7A7; @@ -27,7 +29,7 @@ vn-drop-down { padding: 0; margin: 0; background: white; - max-height: 400px; + max-height: 378px; overflow-y: auto; li { outline: none; @@ -55,4 +57,24 @@ vn-drop-down { } } } +} +#ddBack { + position: fixed; + z-index: 9998; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; +} +vn-drop-down.fixed-dropDown { + position: fixed; + margin: 0; + padding: 0; + .dropdown-body{ + height: 100%; + ul{ + border-bottom: 1px solid #A7A7A7; + } + } } \ No newline at end of file diff --git a/client/core/src/grid-header/style.scss b/client/core/src/grid-header/style.scss index cc983dcf1..8f3475b35 100644 --- a/client/core/src/grid-header/style.scss +++ b/client/core/src/grid-header/style.scss @@ -2,7 +2,6 @@ vn-grid-header { border-bottom: 3px solid #9D9D9D; font-weight: bold; .orderly{ - cursor: pointer; text-align: center; white-space: nowrap; justify-content: center; @@ -11,13 +10,18 @@ vn-grid-header { } } vn-icon{ - line-height: 17px; - font-size: 17px; margin: 0; padding: 0; - display: inline; i { - padding-top: 3px; + padding: 0; + margin: -2px -17px 0 0; + opacity: 0.2; + cursor: pointer; + } + &.active { + i { + opacity: 1; + } } } [min-none]{ diff --git a/client/core/src/icon-menu/icon-menu.html b/client/core/src/icon-menu/icon-menu.html index 6f49a6f7e..c2d5ffeff 100644 --- a/client/core/src/icon-menu/icon-menu.html +++ b/client/core/src/icon-menu/icon-menu.html @@ -1,7 +1,7 @@ -
+
{ this.$timeout(() => { - this.showDropDown = true; + this.mouseFocus = true; + this.showDropDown = this.focused; }); }); this.$element.bind('mouseout', () => { this.$timeout(() => { - this.showDropDown = false; + this.mouseFocus = false; + this.showDropDown = this.focused; }); }); this.$element.bind('focusin', e => { this.$timeout(() => { + this.focused = true; this.showDropDown = true; }); }); this.$element.bind('focusout', e => { this.$timeout(() => { - this.showDropDown = false; + this.focused = false; + this.showDropDown = this.mouseFocus; }); }); } diff --git a/client/core/src/icon-menu/icon-menu.spec.js b/client/core/src/icon-menu/icon-menu.spec.js index 548a1fca5..11be1ff62 100644 --- a/client/core/src/icon-menu/icon-menu.spec.js +++ b/client/core/src/icon-menu/icon-menu.spec.js @@ -15,6 +15,7 @@ describe('Component vnIconMenu', () => { beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$timeout_) => { $componentController = _$componentController_; $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $timeout = _$timeout_; $scope = $rootScope.$new(); $element = angular.element('
'); diff --git a/client/core/src/lib/app.js b/client/core/src/lib/app.js index dd6ef1f09..c3676de77 100644 --- a/client/core/src/lib/app.js +++ b/client/core/src/lib/app.js @@ -7,8 +7,13 @@ import {module} from '../module'; * @property {Snackbar} snackbar The main object to show messages. */ export default class App { + constructor($rootScope) { + this.loaderStatus = 0; + this.$rootScope = $rootScope; + } show(message) { - if (this.snackbar) this.snackbar.show({message: message}); + this.timeout = window.snackbarTimeout || 2000; + if (this.snackbar) this.snackbar.show({message: message, timeout: this.timeout}); } showMessage(message) { this.show(message); @@ -16,5 +21,17 @@ export default class App { showError(message) { this.show(`Error: ${message}`); } + pushLoader() { + this.loaderStatus++; + if (this.loaderStatus === 1) + this.$rootScope.loading = true; + } + popLoader() { + this.loaderStatus--; + if (this.loaderStatus === 0) + this.$rootScope.loading = false; + } } +App.$inject = ['$rootScope']; + module.service('vnApp', App); diff --git a/client/core/src/lib/crud.js b/client/core/src/lib/crud.js index df5c5d062..fe2c39af2 100644 --- a/client/core/src/lib/crud.js +++ b/client/core/src/lib/crud.js @@ -8,6 +8,14 @@ function index(mgIndex) { } module.factory('vnIndex', index); +nonAuto.$inject = ['mgIndex']; +function nonAuto(mgIndex) { + return Object.assign({}, mgIndex, { + auto: false + }); +} +module.factory('vnIndexNonAuto', nonAuto); + successFactoryCreate.$inject = ['mgSuccessFactoryCreate']; function successFactoryCreate(create) { return Object.assign({}, create, { diff --git a/client/core/src/lib/fullEmpty.js b/client/core/src/lib/fullEmpty.js new file mode 100644 index 000000000..86c8e6bce --- /dev/null +++ b/client/core/src/lib/fullEmpty.js @@ -0,0 +1,9 @@ +import {module} from '../module'; + +const isFullEmpty = item => { + return (item === null || item === undefined) || (typeof item === 'object' && !Object.keys(item).length); +}; + +export default isFullEmpty; +export const NAME = 'isFullEmpty'; +module.value(NAME, isFullEmpty); diff --git a/client/core/src/lib/index.js b/client/core/src/lib/index.js index a081b5f87..46c4e4882 100644 --- a/client/core/src/lib/index.js +++ b/client/core/src/lib/index.js @@ -14,3 +14,4 @@ export {NAME as INTERPOLATE, Interpolate} from './interpolate'; export {NAME as COPY_OBJECT} from './copy'; export {NAME as EQUALS_OBJECT} from './equals'; export {NAME as GET_DATA_MODIFIED, factory as Modified} from './modified'; +export {NAME as VALID_KEY} from './keyCodes'; diff --git a/client/core/src/lib/input.js b/client/core/src/lib/input.js new file mode 100644 index 000000000..8db191c33 --- /dev/null +++ b/client/core/src/lib/input.js @@ -0,0 +1,13 @@ +import Component from './component'; + +/** + * Component that host an input. + */ +export default class Input extends Component { + select() { + this.input.select(); + } + focus() { + this.input.focus(); + } +} diff --git a/client/core/src/lib/interceptor.js b/client/core/src/lib/interceptor.js index 9cd97d78a..6d9266018 100644 --- a/client/core/src/lib/interceptor.js +++ b/client/core/src/lib/interceptor.js @@ -1,11 +1,10 @@ import {module} from '../module'; -interceptor.$inject = ['$q', '$rootScope', '$window', 'vnApp', '$translate', '$cookies']; -function interceptor($q, $rootScope, $window, vnApp, $translate, $cookies) { - $rootScope.loading = false; +interceptor.$inject = ['$q', '$window', 'vnApp', '$translate', '$cookies']; +function interceptor($q, $window, vnApp, $translate, $cookies) { return { request: function(config) { - $rootScope.loading = true; + vnApp.pushLoader(); let token = $cookies.get('vnToken'); if (token) @@ -23,11 +22,11 @@ function interceptor($q, $rootScope, $window, vnApp, $translate, $cookies) { case 'PATCH': vnApp.showMessage($translate.instant('Data saved!')); } - $rootScope.loading = false; + vnApp.popLoader(); return response; }, responseError: function(rejection) { - $rootScope.loading = false; + vnApp.popLoader(); let data = rejection.data; let error; diff --git a/client/core/src/lib/keyCodes.js b/client/core/src/lib/keyCodes.js new file mode 100644 index 000000000..9586868ec --- /dev/null +++ b/client/core/src/lib/keyCodes.js @@ -0,0 +1,19 @@ +import {module} from '../module'; + +const validKey = key => { + let keycode = key.keyCode || key; + + let valid = + (keycode > 47 && keycode < 58) || // number keys + (keycode > 64 && keycode < 91) || // letter keys + (keycode > 95 && keycode < 112) || // numpad keys + (keycode > 185 && keycode < 193) || // ;=,-./` (in order) + (keycode > 218 && keycode < 223); // [\]' (in order) + + return valid; +}; + +export default validKey; + +export const NAME = 'validKey'; +module.value(NAME, validKey); diff --git a/client/core/src/lib/modified.js b/client/core/src/lib/modified.js index 79f725633..f62bc91ae 100644 --- a/client/core/src/lib/modified.js +++ b/client/core/src/lib/modified.js @@ -3,6 +3,9 @@ import isEqual from './equals'; export default function getModifiedData(object, objectOld) { var newObject = {}; + if (objectOld === null) { + return object; + } for (var k in object) { var val = object[k]; var valOld = objectOld[k] === undefined ? null : objectOld[k]; diff --git a/client/core/src/lib/moduleLoader.js b/client/core/src/lib/moduleLoader.js index 3408afe31..82d671454 100644 --- a/client/core/src/lib/moduleLoader.js +++ b/client/core/src/lib/moduleLoader.js @@ -1,59 +1,59 @@ import {module} from '../module'; import splitingRegister from './splitingRegister'; -factory.$inject = ['$translatePartialLoader', '$http', '$window', '$ocLazyLoad', '$q', '$translate']; -export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q, $translate) { +factory.$inject = ['$http', '$window', '$ocLazyLoad', '$translatePartialLoader', '$translate']; +export function factory($http, $window, $ocLazyLoad, $translatePartialLoader, $translate) { class ModuleLoader { constructor() { - this._loadedModules = {}; + this._loaded = {}; } load(moduleName, validations) { - if (this._loadedModules[moduleName]) - return; + let loaded = this._loaded; - this._loadedModules[moduleName] = true; + if (loaded[moduleName]) + return loaded[moduleName]; + + loaded[moduleName] = Promise.resolve(true); let deps = splitingRegister.getDependencies(moduleName); - let modules = splitingRegister.modules; - let promises = []; + let depPromises = []; + + if (deps) + for (let dep of deps) + depPromises.push(this.load(dep, validations)); + + loaded[moduleName] = new Promise((resolve, reject) => { + Promise.all(depPromises) + .then(() => { + let promises = []; + + // FIXME: https://github.com/angular-translate/angular-translate/pull/1674 + $translatePartialLoader.addPart(moduleName); + promises.push($translate.refresh()); + + if (validations) + promises.push(new Promise(resolve => { + $http.get(`/${moduleName}/validations`).then( + json => this.onValidationsReady(json, resolve), + json => resolve() + ); + })); - for (let dep of deps) { - this._loadedModules[dep] = true; - promises.push(modules[dep]()); - if (validations) promises.push(new Promise(resolve => { - $http.get(`/${dep}/validations`).then( - json => this.onValidationsReady(json, resolve), - json => resolve() - ); + splitingRegister.modules[moduleName](resolve); })); - $translatePartialLoader.addPart(dep); - // FIXME: https://github.com/angular-translate/angular-translate/pull/1674 - // promises.push($translate.refresh()); - setTimeout(() => $translate.refresh(), 500); - } - - let ocDeps = deps.map(item => { - return {name: item}; + Promise.all(promises) + .then(() => { + this._loaded[moduleName] = true; + resolve($ocLazyLoad.load({name: moduleName})); + }) + .catch(reject); + }) + .catch(reject); }); - return new Promise(resolve => { - Promise.all(promises).then( - () => resolve($ocLazyLoad.load(ocDeps)) - ); - }); - } - parseValidation(val) { - switch (val.validation) { - case 'custom': - // TODO: Reemplazar eval - val.bindedFunction = eval(`(${val.bindedFunction})`); - break; - case 'format': - val.with = new RegExp(val.with); - break; - } + return loaded[moduleName]; } onValidationsReady(json, resolve) { let entities = json.data; @@ -69,6 +69,17 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q Object.assign($window.validations, json.data); resolve(); } + parseValidation(val) { + switch (val.validation) { + case 'custom': + // TODO: Replace eval + val.bindedFunction = eval(`(${val.bindedFunction})`); + break; + case 'format': + val.with = new RegExp(val.with); + break; + } + } } return new ModuleLoader(); diff --git a/client/core/src/lib/specs/aclService.spec.js b/client/core/src/lib/specs/aclService.spec.js new file mode 100644 index 000000000..45a820acc --- /dev/null +++ b/client/core/src/lib/specs/aclService.spec.js @@ -0,0 +1,50 @@ +describe('Service acl', () => { + let aclService; + + beforeEach(() => { + angular.mock.module('vnCore'); + }); + + beforeEach(angular.mock.module($provide => { + $provide.value('aclConstant', {}); + })); + + beforeEach(inject((_aclService_, $httpBackend) => { + aclService = _aclService_; + })); + + it("should return false as the service doesn't have roles", () => { + expect(aclService.routeHasPermission('http://www.verdnatura.es')).toBeFalsy(); + }); + + it("should return true as the service has roles but the route has no acl", () => { + aclService.roles = {customer: true}; + + expect(aclService.routeHasPermission('http://www.verdnatura.es')).toBeTruthy(); + }); + + it("should return false as the service roles have no length", () => { + aclService.roles = {}; + let route = {url: 'http://www.verdnatura.es', acl: []}; + + expect(aclService.routeHasPermission(route)).toBeFalsy(); + }); + + it("should call the service aclPermission() function and return false as the service has roles and the rote has acl without length", () => { + aclService.roles = {customer: true, employee: true}; + let route = {url: 'http://www.verdnatura.es', acl: []}; + spyOn(aclService, 'aclPermission').and.callThrough(); + + expect(aclService.routeHasPermission(route)).toBeFalsy(); + expect(aclService.aclPermission).toHaveBeenCalledWith(route.acl); + }); + + it("should call the service aclPermission() function to return true as the service has roles matching with the ones in acl", () => { + aclService.roles = {customer: true, employee: true}; + let route = {url: 'http://www.verdnatura.es', acl: ['customer']}; + spyOn(aclService, 'aclPermission').and.callThrough(); + + expect(aclService.routeHasPermission(route)).toBeTruthy(); + expect(aclService.aclPermission).toHaveBeenCalledWith(route.acl); + }); +}); diff --git a/client/core/src/lib/splitingRegister.js b/client/core/src/lib/splitingRegister.js index 60c52f0bc..d6af3de64 100644 --- a/client/core/src/lib/splitingRegister.js +++ b/client/core/src/lib/splitingRegister.js @@ -1,29 +1,11 @@ class SplitingRegister { constructor() { - this._graph = null; - this._modules = {}; + this.graph = null; + this.modules = {}; } - get modules() { - return this._modules; - } - getDependencies(dependency) { - var array = []; - array.push(dependency); - var first = this._graph[dependency]; - - if (first) - while (first.length > 0) { - dependency = first.shift(); - array = array.concat(this.getDependencies(dependency)); - } - return array; - } - registerGraph(graph) { - this._graph = graph; - } - register(moduleName, loader) { - this._modules[moduleName] = loader; + getDependencies(moduleName) { + return this.graph[moduleName]; } } diff --git a/client/core/src/lib/validator.js b/client/core/src/lib/validator.js index d31fa9e36..9f8d6d53f 100644 --- a/client/core/src/lib/validator.js +++ b/client/core/src/lib/validator.js @@ -1,20 +1,21 @@ import {validator} from 'vendor'; export const validators = { - presence: function(value, conf) { - if (validator.isEmpty(value)) + presence: value => { + if (validator.isEmpty(value ? String(value) : '')) throw new Error(`Value can't be empty`); }, - absence: function(value, conf) { + absence: value => { if (!validator.isEmpty(value)) throw new Error(`Value should be empty`); }, - length: function(value, conf) { + length: (value, conf) => { let options = { min: conf.min || conf.is, max: conf.max || conf.is }; - if (!validator.isLength(value, options)) { + let val = value ? String(value) : ''; + if (!validator.isLength(val, options)) { if (conf.is) { throw new Error(`Value should be ${conf.is} characters long`); } else if (conf.min && conf.max) { @@ -26,26 +27,26 @@ export const validators = { } } }, - numericality: function(value, conf) { + numericality: (value, conf) => { if (conf.int) { if (!validator.isInt(value)) throw new Error(`Value should be integer`); } else if (!validator.isNumeric(value)) throw new Error(`Value should be a number`); }, - inclusion: function(value, conf) { + inclusion: (value, conf) => { if (!validator.isIn(value, conf.in)) throw new Error(`Invalid value`); }, - exclusion: function(value, conf) { + exclusion: (value, conf) => { if (validator.isIn(value, conf.in)) throw new Error(`Invalid value`); }, - format: function(value, conf) { + format: (value, conf) => { if (!validator.matches(value, conf.with)) throw new Error(`Invalid value`); }, - custom: function(value, conf) { + custom: (value, conf) => { if (!conf.bindedFunction(value)) throw new Error(`Invalid value`); } @@ -73,7 +74,7 @@ export function validate(value, conf) { try { checkNull(value, conf); - if (validator && value != null) + if (validator) // && value != null ?? validator(value, conf); } catch (e) { let message = conf.message ? conf.message : e.message; diff --git a/client/core/src/locale/en.json b/client/core/src/locale/en.json deleted file mode 100644 index bcfbdd6d6..000000000 --- a/client/core/src/locale/en.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Accept": "Accept", - "Cancel": "Cancel", - "Close": "Close", - "Clear": "Clear", - "Save": "Save", - "Add": "Add", - "Search": "Search" -} \ No newline at end of file diff --git a/client/core/src/locale/en.yml b/client/core/src/locale/en.yml new file mode 100644 index 000000000..3fe077dcb --- /dev/null +++ b/client/core/src/locale/en.yml @@ -0,0 +1,7 @@ +Accept: Accept +Cancel: Cancel +Close: Close +Clear: Clear +Save: Save +Add: Add +Search: Search \ No newline at end of file diff --git a/client/core/src/locale/es.json b/client/core/src/locale/es.json deleted file mode 100644 index 8a44ead1c..000000000 --- a/client/core/src/locale/es.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Accept": "Aceptar", - "Cancel": "Cancelar", - "Close": "Cerrar", - "Clear": "Borrar", - "Save": "Guardar", - "Add": "Añadir", - "Search": "Buscar", - "Show More": "Ver más", - "No more results" : "No hay más resultados" -} \ No newline at end of file diff --git a/client/core/src/locale/es.yml b/client/core/src/locale/es.yml new file mode 100644 index 000000000..bd2e3ee86 --- /dev/null +++ b/client/core/src/locale/es.yml @@ -0,0 +1,9 @@ +Accept: Aceptar +Cancel: Cancelar +Close: Cerrar +Clear: Borrar +Save: Guardar +Add: Añadir +Search: Buscar +Show More: Ver más +No more results : No hay más resultados \ No newline at end of file diff --git a/client/core/src/mdl-override.css b/client/core/src/mdl-override.css index 83043a144..3a1f391a2 100644 --- a/client/core/src/mdl-override.css +++ b/client/core/src/mdl-override.css @@ -1,60 +1,60 @@ -/** - * Rewrited CSS rules from Material Design Lite. - * TODO: don't use !important - */ - -.mdl-textfield { - width: 100%; -} - -.mdl-button { - font-weight: bolder; - color: #ffa410; -} -.mdl-button--colored { - color: white !important; -} -.mdl-button--colored, -.mdl-button--colored:focus, -.mdl-button--colored:active { - background-color: #ffa410 !important; -} -.mdl-button--colored:hover, -.mdl-button--raised:hover { - background-color: #ffa410 !important; -} -.mdl-button--fab{ - color: white !important; - background-color: #ff9400 !important; -} - -.mdl-dialog__actions--full-width>*{ - text-align: center; -} - -.mdl-dialog{ - width: 400px; - font-family: raleway-regular; - line-height:60px; - text-align: center; -} - -.mdl-textfield__error { - visibility: visible; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: 100%; -} -.mdl-textfield.invalid .mdl-textfield__input { - border-color: #d50000; - box-shadow: none; -} -.mdl-textfield.invalid .mdl-textfield__label::after { - background-color: #d50000; -} -.mdl-textfield--floating-label.invalid .mdl-textfield__label { - color: #d50000; - font-size: 12px; - top: 4px; -} +/** + * Rewrited CSS rules from Material Design Lite. + * TODO: don't use !important + */ + +.mdl-textfield { + width: 100%; +} + +.mdl-button { + font-weight: bolder; + color: #ffa410; +} +.mdl-button--colored { + color: white !important; +} +.mdl-button--colored, +.mdl-button--colored:focus, +.mdl-button--colored:active { + background-color: #ffa410 !important; +} +.mdl-button--colored:hover, +.mdl-button--raised:hover { + background-color: #ffa410 !important; +} +.mdl-button--fab{ + color: white !important; + background-color: #ff9400 !important; +} + +.mdl-dialog__actions--full-width>*{ + text-align: center; +} + +.mdl-dialog{ + width: 400px; + font-family: vn-font; + line-height:60px; + text-align: center; +} + +.mdl-textfield__error { + visibility: visible; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: 100%; +} +.mdl-textfield.invalid .mdl-textfield__input { + border-color: #d50000; + box-shadow: none; +} +.mdl-textfield.invalid .mdl-textfield__label::after { + background-color: #d50000; +} +.mdl-textfield--floating-label.invalid .mdl-textfield__label { + color: #d50000; + font-size: 12px; + top: 4px; +} diff --git a/client/core/src/textfield/style.scss b/client/core/src/textfield/style.scss index aafeee204..0f9d95c8e 100644 --- a/client/core/src/textfield/style.scss +++ b/client/core/src/textfield/style.scss @@ -7,12 +7,18 @@ vn-textfield { width: auto; top: 0px; right: -6px; - margin: 22px 0px; - background-color: white; + margin: 21px 0px; + background: white; + opacity: 1; + z-index: 9999; + color: #aaa; } .material-icons { font-size: 18px; float: right; - margin-right: 5px; + margin-right: 5px; + } + .material-icons:hover { + color: rgba(0,0,0, .87); } } \ No newline at end of file diff --git a/client/core/src/textfield/textfield.html b/client/core/src/textfield/textfield.html index 3b8f24e1e..e709c835d 100644 --- a/client/core/src/textfield/textfield.html +++ b/client/core/src/textfield/textfield.html @@ -1,11 +1,7 @@
+ ng-mouseleave="$ctrl.hasMouseIn = false"> + ng-focus="$ctrl.hasFocus = true" + ng-blur="$ctrl.hasFocus = false" + />
- info_outline - clear + + info_outline + + + clear +
diff --git a/client/core/src/textfield/textfield.js b/client/core/src/textfield/textfield.js index 09d65ab9d..b9262bc0e 100644 --- a/client/core/src/textfield/textfield.js +++ b/client/core/src/textfield/textfield.js @@ -1,9 +1,8 @@ import {module} from '../module'; -import Component from '../lib/component'; -import * as normalizerFactory from '../lib/inputAttrsNormalizer'; +import Input from '../lib/input'; import './style.scss'; -export default class TextfieldController extends Component { +export default class Textfield extends Input { constructor($element, $scope, $attrs, $timeout, normalizer) { super($element); @@ -15,45 +14,42 @@ export default class TextfieldController extends Component { this.$timeout = $timeout; this._value = null; - this.type = this.$attrs.type || 'text'; + this.type = $attrs.type || 'text'; this.showActions = false; this.input = $element[0].querySelector('input'); - this.focus = false; - this.hasInfo = Boolean(this.$attrs.info); - this.info = this.$attrs.info || null; + this.hasInfo = Boolean($attrs.info); + this.info = $attrs.info || null; this.hasFocus = false; this.hasMouseIn = false; componentHandler.upgradeElement($element[0].firstChild); } - get value() { return this._value; } - set value(value) { this._value = (value === undefined || value === '') ? null : value; this.input.value = this._value; this.hasValue = Boolean(this._value); this.mdlUpdate(); } - + set tabIndex(value) { + this.input.tabIndex = value; + } mdlUpdate() { let mdlField = this.$element[0].firstChild.MaterialTextfield; if (mdlField) mdlField.updateClasses_(); } - clear() { this.value = null; this.input.focus(); } } - -TextfieldController.$inject = ['$element', '$scope', '$attrs', '$timeout', normalizerFactory.NAME]; +Textfield.$inject = ['$element', '$scope', '$attrs', '$timeout', 'vnInputAttrsNormalizer']; module.component('vnTextfield', { template: require('./textfield.html'), - controller: TextfieldController, + controller: Textfield, bindings: { value: '=model', label: '@?', @@ -61,6 +57,7 @@ module.component('vnTextfield', { disabled: ' this.$state.go(state) + () => this.$state.go(state, params || {}) ); } /** @@ -92,10 +94,10 @@ export default class Watcher extends Component { (resolve, reject) => this.noChanges(reject) ); } - let changedData = getModifiedData(this.data, this.orgData); + let changedData = (this.$attrs.save && this.$attrs.save.toLowerCase() === 'post') ? this.copyInNewObject(this.data) : getModifiedData(this.data, this.orgData); - if (this.save) { - this.save.model = changedData; + if (this.save && this.save.accept) { + this.save.model = changedData; // this.copyInNewObject(changedData); return new Promise((resolve, reject) => { this.save.accept().then( json => this.writeData({data: json}, resolve), @@ -106,7 +108,7 @@ export default class Watcher extends Component { // XXX: Alternative when mgCrud is not used - let id = this.orgData[this.idField]; + let id = this.idField ? this.orgData[this.idField] : null; if (id) { return new Promise((resolve, reject) => { @@ -118,7 +120,7 @@ export default class Watcher extends Component { } return new Promise((resolve, reject) => { - this.$http.post(this.url, this.data).then( + this.$http.post(this.url, changedData).then( json => this.writeData(json, resolve), json => reject(json) ); @@ -147,6 +149,8 @@ export default class Watcher extends Component { updateOriginalData() { this.orgData = this.copyInNewObject(this.data); + if (this.form && this.form.$dirty) + this.form.$setPristine(); } copyInNewObject(data) { @@ -154,7 +158,7 @@ export default class Watcher extends Component { if (data && typeof data === 'object') { Object.keys(data).forEach( val => { - if (data[val] !== "" && data[val] !== undefined && data[val] !== null) { + if (!isFullEmpty(data[val])) { if (typeof data[val] === 'object') { newCopy[val] = this.copyInNewObject(data[val]); } else { @@ -179,6 +183,7 @@ export default class Watcher extends Component { } dataChanged() { + if (this.form && this.form.$dirty) return true; let newData = this.copyInNewObject(this.data); return !isEqual(newData, this.orgData); } @@ -193,7 +198,7 @@ export default class Watcher extends Component { } } -Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnApp', '$translate']; +Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnApp', '$translate', '$attrs']; module.component('vnWatcher', { template: require('./watcher.html'), diff --git a/client/core/src/watcher/watcher.spec.js b/client/core/src/watcher/watcher.spec.js index 0ed342e31..231680f28 100644 --- a/client/core/src/watcher/watcher.spec.js +++ b/client/core/src/watcher/watcher.spec.js @@ -11,6 +11,7 @@ describe('Component vnWatcher', () => { let vnApp; let $translate; let controller; + let $attrs; beforeEach(() => { angular.mock.module('client'); @@ -24,8 +25,12 @@ describe('Component vnWatcher', () => { vnApp = _vnApp_; $transitions = _$transitions_; $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); $translate = _$translate_; - controller = $componentController('vnWatcher', {$scope, $element, $state, vnApp, $transitions, $httpBackend, $translate}); + $attrs = { + save: "patch" + }; + controller = $componentController('vnWatcher', {$scope, $element, $state, vnApp, $transitions, $httpBackend, $translate, $attrs}); })); describe('$onInit()', () => { @@ -100,11 +105,11 @@ describe('Component vnWatcher', () => { it(`should call controller.$state.go() function after calling controllers submit() function`, done => { spyOn(controller, 'submit').and.returnValue(Promise.resolve()); spyOn(controller.$state, 'go'); - let state = 'the state'; + let state = 'the.State'; controller.submitGo(state) .then(() => { expect(controller.submit).toHaveBeenCalledWith(); - expect(controller.$state.go).toHaveBeenCalledWith(state); + expect(controller.$state.go).toHaveBeenCalledWith(state, {}); done(); }); }); @@ -140,7 +145,7 @@ describe('Component vnWatcher', () => { describe('when controller.save()', () => { it(`should set controller.save.model property`, () => { - controller.save = {}; + controller.save = {accept: () => {}}; controller.data = {originalInfo: 'original data', info: 'new data'}; controller.orgData = {originalInfo: 'original data'}; controller.submit(); @@ -290,4 +295,3 @@ describe('Component vnWatcher', () => { }); }); }); -// 309 \ No newline at end of file diff --git a/client/item/index.js b/client/item/index.js new file mode 100644 index 000000000..c94fde7de --- /dev/null +++ b/client/item/index.js @@ -0,0 +1 @@ +export * from './src/item'; diff --git a/client/item/routes.json b/client/item/routes.json new file mode 100644 index 000000000..74dbe6dad --- /dev/null +++ b/client/item/routes.json @@ -0,0 +1,106 @@ +{ + "module": "item", + "name": "Items", + "icon": "/static/images/icon_item.png", + "validations" : true, + "routes": [ + { + "url": "/item", + "state": "item", + "abstract": true, + "component": "ui-view" + }, + { + "url": "/list", + "state": "item.index", + "component": "vn-item-list", + "acl": ["developer"] + }, { + "url": "/create", + "state": "item.create", + "component": "vn-item-create" + }, { + "url": "/:id", + "state": "item.card", + "abstract": true, + "component": "vn-item-card" + }, { + "url" : "/data", + "state": "item.card.data", + "component": "vn-item-data", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "Basic data", + "icon": "folder" + } + },{ + "url" : "/tags", + "state": "item.card.tags", + "component": "vn-item-tags", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "Tags", + "icon": "folder" + } + },{ + "url" : "/history", + "state": "item.card.history", + "component": "vn-item-history", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "History", + "icon": "folder" + } + },{ + "url" : "/niche", + "state": "item.card.niche", + "component": "vn-item-niche", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "Niche", + "icon": "folder" + } + },{ + "url" : "/botanical", + "state": "item.card.botanical", + "component": "vn-item-botanical", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "Botanical", + "icon": "folder" + } + },{ + "url" : "/picture", + "state": "item.card.picture", + "component": "vn-item-picture", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "Picture", + "icon": "folder" + } + }, { + "url" : "/barcode", + "state": "item.card.barcode", + "component": "vn-item-barcode", + "params": { + "item": "$ctrl.item" + }, + "menu": { + "description": "Barcode", + "icon": "folder" + } + } + ] +} \ No newline at end of file diff --git a/client/item/src/barcode/item-barcode.html b/client/item/src/barcode/item-barcode.html new file mode 100644 index 000000000..549ac04d1 --- /dev/null +++ b/client/item/src/barcode/item-barcode.html @@ -0,0 +1,5 @@ + + + Item barcode + + \ No newline at end of file diff --git a/client/item/src/barcode/item-barcode.js b/client/item/src/barcode/item-barcode.js new file mode 100644 index 000000000..850c262b8 --- /dev/null +++ b/client/item/src/barcode/item-barcode.js @@ -0,0 +1,5 @@ +import ngModule from '../module'; + +ngModule.component('vnItemBarcode', { + template: require('./item-barcode.html') +}); diff --git a/client/item/src/botanical/item-botanical.html b/client/item/src/botanical/item-botanical.html new file mode 100644 index 000000000..36cd49f8f --- /dev/null +++ b/client/item/src/botanical/item-botanical.html @@ -0,0 +1,5 @@ + + + Botanical + + \ No newline at end of file diff --git a/client/item/src/botanical/item-botanical.js b/client/item/src/botanical/item-botanical.js new file mode 100644 index 000000000..8bd744e53 --- /dev/null +++ b/client/item/src/botanical/item-botanical.js @@ -0,0 +1,5 @@ +import ngModule from '../module'; + +ngModule.component('vnItemBotanical', { + template: require('./item-botanical.html') +}); diff --git a/client/item/src/card/item-card.html b/client/item/src/card/item-card.html new file mode 100644 index 000000000..6696d07fd --- /dev/null +++ b/client/item/src/card/item-card.html @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/client/item/src/card/item-card.js b/client/item/src/card/item-card.js new file mode 100644 index 000000000..aeb921651 --- /dev/null +++ b/client/item/src/card/item-card.js @@ -0,0 +1,35 @@ +import ngModule from '../module'; + +class ItemCard { + constructor($http, $state) { + this.$http = $http; + this.$state = $state; + this.item = {}; + } + + $onInit() { + let filter = { + include: [ + {relation: "itemType"}, + {relation: "origin"}, + {relation: "ink"}, + {relation: "producer"}, + {relation: "intrastat"}, + {relation: "expence"}, + {relation: "taxClass"}, + {relation: "itemTag", scope: {order: "priority ASC", include: {relation: "tag"}}} + ] + }; + this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then( + res => { + this.item = res.data; + } + ); + } +} +ItemCard.$inject = ['$http', '$state']; + +ngModule.component('vnItemCard', { + template: require('./item-card.html'), + controller: ItemCard +}); diff --git a/client/item/src/card/item-card.spec.js b/client/item/src/card/item-card.spec.js new file mode 100644 index 000000000..5447d007e --- /dev/null +++ b/client/item/src/card/item-card.spec.js @@ -0,0 +1,33 @@ +import './item-card.js'; + +describe('Item', () => { + describe('Component vnItemCard', () => { + let $componentController; + let $httpBackend; + let $state; + let controller; + + beforeEach(() => { + angular.mock.module('item'); + }); + + beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => { + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $state = _$state_; + controller = $componentController('vnItemCard', {$state: $state}); + })); + + describe('$onInit()', () => { + it('should request to patch the propagation of tax status', () => { + controller.client = {id: 123, isEqualizated: false}; + $httpBackend.whenGET('/item/api/Items/undefined?filter={"include":[{"relation":"itemType"},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"},{"relation":"taxClass"},{"relation":"itemTag","scope":{"order":"priority ASC","include":{"relation":"tag"}}}]}').respond({data: 'item'}); + $httpBackend.expectGET('/item/api/Items/undefined?filter={"include":[{"relation":"itemType"},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"},{"relation":"taxClass"},{"relation":"itemTag","scope":{"order":"priority ASC","include":{"relation":"tag"}}}]}'); + controller.$onInit(); + $httpBackend.flush(); + + expect(controller.item).toEqual({data: 'item'}); + }); + }); + }); +}); diff --git a/client/item/src/create/item-create.html b/client/item/src/create/item-create.html new file mode 100644 index 000000000..d57806715 --- /dev/null +++ b/client/item/src/create/item-create.html @@ -0,0 +1,59 @@ + + + +
+
+ + + New item + + + + + + + + {{$parent.$parent.item.description}} + + + + + + + + + + + + +
+
diff --git a/client/item/src/create/item-create.js b/client/item/src/create/item-create.js new file mode 100644 index 000000000..415e67c4f --- /dev/null +++ b/client/item/src/create/item-create.js @@ -0,0 +1,23 @@ +import ngModule from '../module'; + +class ItemCreate { + constructor($scope, $state) { + this.$ = $scope; + this.$state = $state; + this.item = { + relevancy: 0 + }; + } + + onSubmit() { + this.$.watcher.submit().then( + json => this.$state.go('item.card.data', {id: json.data.id}) + ); + } +} +ItemCreate.$inject = ['$scope', '$state']; + +ngModule.component('vnItemCreate', { + template: require('./item-create.html'), + controller: ItemCreate +}); diff --git a/client/item/src/create/item-create.spec.js b/client/item/src/create/item-create.spec.js new file mode 100644 index 000000000..e63265ee7 --- /dev/null +++ b/client/item/src/create/item-create.spec.js @@ -0,0 +1,40 @@ +import './item-create.js'; + +describe('Item', () => { + describe('Component vnItemCreate', () => { + let $componentController; + let $scope; + let $state; + let controller; + + beforeEach(() => { + angular.mock.module('item'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => { + $componentController = _$componentController_; + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = { + submit: () => { + return { + then: callback => { + callback({data: {id: 1}}); + } + }; + } + }; + controller = $componentController('vnItemCreate', {$scope: $scope}); + })); + + describe('onSubmit()', () => { + it(`should call submit() on the watcher then expect a callback`, () => { + spyOn($state, 'go'); + controller.onSubmit(); + + expect(controller.$state.go).toHaveBeenCalledWith('item.card.data', {id: 1}); + }); + }); + }); +}); + diff --git a/client/item/src/data/item-data.html b/client/item/src/data/item-data.html new file mode 100644 index 000000000..16deded6c --- /dev/null +++ b/client/item/src/data/item-data.html @@ -0,0 +1,82 @@ + + + + + +
+ + + Basic data + + + + + + + + {{$parent.$parent.item.description}} + + + + + + + + + + + {{$parent.$parent.item.description}} + + + + + + + +
+ diff --git a/client/item/src/data/item-data.js b/client/item/src/data/item-data.js new file mode 100644 index 000000000..6046e8dbc --- /dev/null +++ b/client/item/src/data/item-data.js @@ -0,0 +1,8 @@ +import ngModule from '../module'; + +ngModule.component('vnItemData', { + template: require('./item-data.html'), + bindings: { + item: '<' + } +}); diff --git a/client/item/src/descriptor/item-descriptor.html b/client/item/src/descriptor/item-descriptor.html new file mode 100644 index 000000000..286e0c733 --- /dev/null +++ b/client/item/src/descriptor/item-descriptor.html @@ -0,0 +1,17 @@ + + + + + + + + + +
Id: {{$ctrl.item.id}}
+
Name: {{$ctrl.item.name}}
+
+
{{itemTag.tag.name}}: {{itemTag.value}}
+
+
+
+
diff --git a/client/item/src/descriptor/item-descriptor.js b/client/item/src/descriptor/item-descriptor.js new file mode 100644 index 000000000..e2c93c484 --- /dev/null +++ b/client/item/src/descriptor/item-descriptor.js @@ -0,0 +1,8 @@ +import ngModule from '../module'; + +ngModule.component('vnItemDescriptor', { + template: require('./item-descriptor.html'), + bindings: { + item: '<' + } +}); diff --git a/client/item/src/filter-panel/filter-panel.html b/client/item/src/filter-panel/filter-panel.html new file mode 100644 index 000000000..607e7e7cc --- /dev/null +++ b/client/item/src/filter-panel/filter-panel.html @@ -0,0 +1,58 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/client/item/src/filter-panel/filter-panel.js b/client/item/src/filter-panel/filter-panel.js new file mode 100644 index 000000000..608918b51 --- /dev/null +++ b/client/item/src/filter-panel/filter-panel.js @@ -0,0 +1,16 @@ +import ngModule from '../module'; + +class ItemFilterPanel { + constructor() { + this.onSubmit = () => {}; + } + + onSearch() { + this.onSubmit(this.filter); + } +} + +ngModule.component('vnItemFilterPanel', { + template: require('./filter-panel.html'), + controller: ItemFilterPanel +}); diff --git a/client/item/src/filter-panel/locale/es.yml b/client/item/src/filter-panel/locale/es.yml new file mode 100644 index 000000000..1411cc42d --- /dev/null +++ b/client/item/src/filter-panel/locale/es.yml @@ -0,0 +1,3 @@ +Ink: Tinta +Origin: Origen +Producer: Productor \ No newline at end of file diff --git a/client/item/src/history/item-history.html b/client/item/src/history/item-history.html new file mode 100644 index 000000000..1a5a65483 --- /dev/null +++ b/client/item/src/history/item-history.html @@ -0,0 +1,33 @@ + + + + + Item history + + + + + + + + + + {{::itemLog.originFk}} + {{::itemLog.userFk}} + {{::itemLog.action}} + {{::itemLog.creationDate | date:'dd/MM/yyyy HH:mm'}} + {{::itemLog.description}} + + + No results + + + + + + + + diff --git a/client/item/src/history/item-history.js b/client/item/src/history/item-history.js new file mode 100644 index 000000000..a07503c81 --- /dev/null +++ b/client/item/src/history/item-history.js @@ -0,0 +1,5 @@ +import ngModule from '../module'; + +ngModule.component('vnItemHistory', { + template: require('./item-history.html') +}); diff --git a/client/item/src/item.js b/client/item/src/item.js new file mode 100644 index 000000000..ddfbb2d05 --- /dev/null +++ b/client/item/src/item.js @@ -0,0 +1,15 @@ +export * from './module'; + +import './list/list'; +import './filter-panel/filter-panel'; +import './create/item-create'; +import './card/item-card'; +import './descriptor/item-descriptor'; +import './data/item-data'; +import './tags/item-tags'; +import './history/item-history'; +import './niche/item-niche'; +import './botanical/item-botanical'; +import './picture/item-picture'; +import './barcode/item-barcode'; + diff --git a/client/item/src/list/item-product.html b/client/item/src/list/item-product.html new file mode 100644 index 000000000..4fde108fd --- /dev/null +++ b/client/item/src/list/item-product.html @@ -0,0 +1,14 @@ + + + + + + +
Id: {{$ctrl.item.id}}
+
Name: {{$ctrl.item.name}}
+
Description: {{$ctrl.item.description}}
+
Size: {{$ctrl.item.size}}
+
Type: {{$ctrl.item.itemType.name}}
+
+
+ diff --git a/client/item/src/list/item-product.js b/client/item/src/list/item-product.js new file mode 100644 index 000000000..4f7c7b4e7 --- /dev/null +++ b/client/item/src/list/item-product.js @@ -0,0 +1,8 @@ +import ngModule from '../module'; + +ngModule.component('vnItemProduct', { + template: require('./item-product.html'), + bindings: { + item: '<' + } +}); diff --git a/client/item/src/list/list.html b/client/item/src/list/list.html new file mode 100644 index 000000000..00f498d4e --- /dev/null +++ b/client/item/src/list/list.html @@ -0,0 +1,26 @@ + +
+
+ + + + + + + + + + + + +
+ + + +
\ No newline at end of file diff --git a/client/item/src/list/list.js b/client/item/src/list/list.js new file mode 100644 index 000000000..db48692d8 --- /dev/null +++ b/client/item/src/list/list.js @@ -0,0 +1,17 @@ +import ngModule from '../module'; +import './item-product'; +import './style.css'; + +class ItemList { + constructor() { + this.model = {}; + } + search(index) { + index.accept(); + } +} + +ngModule.component('vnItemList', { + template: require('./list.html'), + controller: ItemList +}); diff --git a/client/item/src/list/style.css b/client/item/src/list/style.css new file mode 100644 index 000000000..ca53151b9 --- /dev/null +++ b/client/item/src/list/style.css @@ -0,0 +1,20 @@ +vn-item-product { + display: block; +} +a.item-product-link { + display: block; + text-decoration: none; + color: inherit; +} +a.item-product-link:hover { + color: white; + background-color: #424242; +} + +vn-item-product img { + max-width: 150px; +} + +.vn-item-product-name { + font-family: vn-font-bold; +} diff --git a/client/item/src/locale/en.yml b/client/item/src/locale/en.yml new file mode 100644 index 000000000..03f1b1f7f --- /dev/null +++ b/client/item/src/locale/en.yml @@ -0,0 +1 @@ +Artículo: Items \ No newline at end of file diff --git a/client/item/src/locale/es.yml b/client/item/src/locale/es.yml new file mode 100644 index 000000000..a80590f67 --- /dev/null +++ b/client/item/src/locale/es.yml @@ -0,0 +1,21 @@ +Items: Artículos +Item: Artículo +Category: Categoría +Description: Descripción +Size: Tamaño +Type: Tipo +Name: Nombre +Relevancy: Relevancia +New item: Nuevo artículo +Basic data: Datos básicos +History: Historial +Item history: Historial del artículo +Item tags: Tags del artículo +Niche: Nicho +Picture: Foto +Item pictures: Fotos del artículo +Barcode: Código barras +Item barcode: Código de barras del artículo +Changed by: Cambiado por +Action: Acción +Date: Fecha \ No newline at end of file diff --git a/client/item/src/module.js b/client/item/src/module.js new file mode 100644 index 000000000..b44509fb2 --- /dev/null +++ b/client/item/src/module.js @@ -0,0 +1,5 @@ +import {ng} from 'vendor'; +import 'core'; + +const ngModule = ng.module('item', ['vnCore']); +export default ngModule; diff --git a/client/item/src/niche/item-niche.html b/client/item/src/niche/item-niche.html new file mode 100644 index 000000000..9d2297ca2 --- /dev/null +++ b/client/item/src/niche/item-niche.html @@ -0,0 +1,5 @@ + + + Niche + + \ No newline at end of file diff --git a/client/item/src/niche/item-niche.js b/client/item/src/niche/item-niche.js new file mode 100644 index 000000000..caa84c9ea --- /dev/null +++ b/client/item/src/niche/item-niche.js @@ -0,0 +1,5 @@ +import ngModule from '../module'; + +ngModule.component('vnItemNiche', { + template: require('./item-niche.html') +}); diff --git a/client/item/src/picture/item-picture.html b/client/item/src/picture/item-picture.html new file mode 100644 index 000000000..93acec3c9 --- /dev/null +++ b/client/item/src/picture/item-picture.html @@ -0,0 +1,5 @@ + + + Item pictures + + \ No newline at end of file diff --git a/client/item/src/picture/item-picture.js b/client/item/src/picture/item-picture.js new file mode 100644 index 000000000..20fdd8499 --- /dev/null +++ b/client/item/src/picture/item-picture.js @@ -0,0 +1,5 @@ +import ngModule from '../module'; + +ngModule.component('vnItemPicture', { + template: require('./item-picture.html') +}); diff --git a/client/item/src/tags/item-tags.html b/client/item/src/tags/item-tags.html new file mode 100644 index 000000000..8f00b0b29 --- /dev/null +++ b/client/item/src/tags/item-tags.html @@ -0,0 +1,5 @@ + + + Item tags + + \ No newline at end of file diff --git a/client/item/src/tags/item-tags.js b/client/item/src/tags/item-tags.js new file mode 100644 index 000000000..a390820b7 --- /dev/null +++ b/client/item/src/tags/item-tags.js @@ -0,0 +1,5 @@ +import ngModule from '../module'; + +ngModule.component('vnItemTags', { + template: require('./item-tags.html') +}); diff --git a/client/locator/routes.json b/client/locator/routes.json index c76ec3365..b508fcc5f 100644 --- a/client/locator/routes.json +++ b/client/locator/routes.json @@ -8,7 +8,7 @@ "url": "/locator", "state": "locator", "component": "vn-locator-index", - "acl": ["employee"] + "acl": ["developer"] } ] } \ No newline at end of file diff --git a/client/locator/src/locale/en.json b/client/locator/src/locale/en.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/client/locator/src/locale/en.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/client/locator/src/locale/en.yml b/client/locator/src/locale/en.yml new file mode 100644 index 000000000..8d3c81c58 --- /dev/null +++ b/client/locator/src/locale/en.yml @@ -0,0 +1,4 @@ +Routes locator: Routes locator +Filter: Filter +Store: Store +Address: Address \ No newline at end of file diff --git a/client/locator/src/locale/es.json b/client/locator/src/locale/es.json deleted file mode 100644 index e1ac63778..000000000 --- a/client/locator/src/locale/es.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Routes locator": "Localizador de rutas", - "Filter": "Filtro", - "Store": "Almacén", - "Address": "Dirección" -} \ No newline at end of file diff --git a/client/locator/src/locale/es.yml b/client/locator/src/locale/es.yml new file mode 100644 index 000000000..462c393bf --- /dev/null +++ b/client/locator/src/locale/es.yml @@ -0,0 +1,4 @@ +Routes locator: Localizador de rutas +Filter: Filtro +Store: Almacén +Address: Dirección \ No newline at end of file diff --git a/client/modules.json b/client/modules.json deleted file mode 100644 index 62c5e11a1..000000000 --- a/client/modules.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "salix": [], - "auth": [], - "core": [], - "client": [], - "production": [], - "route": [], - "locator": [] -} diff --git a/client/modules.yml b/client/modules.yml new file mode 100644 index 000000000..0236ce1e3 --- /dev/null +++ b/client/modules.yml @@ -0,0 +1,8 @@ +salix: [] +auth: [] +core: [] +client: [] +production: [] +route: [] +locator: [] +item: [] diff --git a/client/production/routes.json b/client/production/routes.json index f0348d7d7..1c3abd874 100644 --- a/client/production/routes.json +++ b/client/production/routes.json @@ -8,7 +8,7 @@ "url": "/production", "state": "production", "component": "vn-production-index", - "acl": ["employee"] + "acl": ["developer"] } ] } \ No newline at end of file diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 5f215808d..63e899206 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,39 +1,37 @@ - - + + Finder - -
- - - - -
- + + + + - + initial-value="$ctrl.filter.warehouseFk" + show-field="name" + value-field="id" + field="$ctrl.filter.warehouseFk" + url="/production/api/Warehouses/production" + on-change = "$ctrl.onChangeWareHouse(item)" + label="Store" + >
- + diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index fff350580..bf111e9f0 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -2,14 +2,13 @@ import ngModule from '../module'; import './style.scss'; export default class ProductionIndex { - constructor($element, $scope, $http, vnPopover, aclConstant) { + constructor($element, $scope, $http, aclConstant) { this.$element = $element; this.$ = $scope; this.$http = $http; - this.vnPopover = vnPopover; this.filter = {}; this.tickets = []; - this.states = []; + this.checkAll = 0; this.footer = { total: null, @@ -17,23 +16,17 @@ export default class ProductionIndex { meters: null }; this._search = null; - this.hourItems = []; + + this.sharedData = { + states: [], + hourItems: [] + }; + this.child = undefined; this.userProfile = aclConstant.userProfile; this.filter.warehouseFk = this.userProfile.warehouseId; } - get search() { - return this._search; - } - set search(value) { - this._search = value; - this.filter.q = value; - if (!value) { - this.searchTickets(); - } - } - get checkAll() { return this._checkAll; } @@ -42,92 +35,53 @@ export default class ProductionIndex { } // Actions Callbacks - _changeState(ids, sateteId, stateName, index) { - this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then( - () => { - index.forEach( - val => { - this.tickets[val].state = stateName; - this.tickets[val].stateFk = sateteId; - } - ); - } - ); - } - _sendMessage(tickets) { - this.$http.post(`/production/api/FakeProductions/messageSend`, {tickets: tickets}).then( - () => { - this.vnApp.showMessage(this.$translate.instant('Success: message send!')); - } - ); - } - _changeTime(ids, time, index) { - this.$http.put(`/production/api/Tickets/${time}/changeTime`, {tickets: ids}).then( - () => { - index.forEach( - val => { - this.tickets[val].hour = time; - } - ); - } - ); + + _changeState(ids, stateId, stateName, index) { + this.$http.put(`/production/api/TicketStates/${stateId}/changeState`, {tickets: ids}).then(() => { + index.forEach(val => { + this.tickets[val].state = stateName; + this.tickets[val].stateFk = stateId; + }); + }); } - moreFilters(event) { - this.child = this.vnPopover.showComponent('vn-production-filter-panel', this.$, this.$element[0].querySelector('.filterPanel')); - var childCtrl = angular.element(this.child).isolateScope().$ctrl; - childCtrl.filter = Object.assign({}, this.filter); - childCtrl.data = Object.assign({}, {states: this.states}, {hourItems: this.hourItems}); - childCtrl.onSubmit = filter => this.onChildSubmit(filter); - childCtrl.onCancel = () => this.onChildCancel(); - event.preventDefault(); - } - onChildSubmit(filter) { - let newFilter = {}; - Object.keys(filter).forEach( - field => { - if (filter[field] !== null) { - newFilter[field] = filter[field]; - } - } - ); - this.searchTickets(newFilter); - this.onChildCancel(); - } - onChildCancel() { - angular.element(this.child).scope().$destroy(); - angular.element(this.child).remove(); - delete this.child; - } - searchTickets(filter) { - this.filter = Object.assign({}, this.filter, filter || {}); - let filters = Object.assign({}, { - where: this.filter - }, { - page: 1, - limit: 1000 + _sendMessage(tickets) { + this.$http.post(`/production/api/FakeProductions/messageSend`, {tickets: tickets}).then(() => { + this.vnApp.showMessage(this.$translate.instant('Success: message send!')); }); - this.checkAll = 0; - this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then( - json => { - this.tickets = json.data.tickets; - this.footer.lines = json.data.lines; - this.footer.meters = json.data.m3; - this.footer.total = json.data.total; - } - ); } + + _changeTime(ids, time, index) { + this.$http.put(`/production/api/Tickets/${time}/changeTime`, {tickets: ids}).then(() => { + index.forEach(val => { + this.tickets[val].hour = time; + }); + }); + } + + searchTickets(filter) { + this.$.index.filter.filter = Object.assign({}, this.filter, filter || {}); + this.checkAll = 0; + this.$.index.accept().then(json => { + this.tickets = json.tickets; + this.footer.lines = json.lines; + this.footer.meters = json.m3; + this.footer.total = json.total; + }); + } + refreshTickets() { this.filter = {}; this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId; - this.search = null; } + onChangeWareHouse(warehouse) { if (warehouse && warehouse != this.filter.warehouseFk) { this.filter.warehouseFk = warehouse; this.searchTickets(this.filter); } } + $onInit() { for (let i = 1; i <= 24; i++) { let hour = [i].join(''); @@ -135,13 +89,13 @@ export default class ProductionIndex { hour = [0, i].join(''); } hour += ':00'; - this.hourItems.push({id: i, name: hour}); + this.sharedData.hourItems.push({id: i, name: hour}); } this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId; } } -ProductionIndex.$inject = ['$element', '$scope', '$http', 'vnPopover', 'aclConstant']; +ProductionIndex.$inject = ['$element', '$scope', '$http', 'aclConstant']; ngModule.component('vnProductionIndex', { template: require('./index.html'), diff --git a/client/production/src/index/index.spec.js b/client/production/src/index/index.spec.js new file mode 100644 index 000000000..dc9f0d89b --- /dev/null +++ b/client/production/src/index/index.spec.js @@ -0,0 +1,39 @@ +import './index.js'; + +describe('Production', () => { + describe('Component vnProductionIndex', () => { + let $componentController; + let $httpBackend; + let $scope; + let controller; + let $element; + let aclConstant; + + beforeEach(() => { + angular.mock.module('production'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => { + $element = angular.element('
'); + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $scope = $rootScope.$new(); + aclConstant = {userProfile: {warehouseId: 1}}; + controller = $componentController('vnProductionIndex', {$scope: $scope, $element: $element, aclConstant: aclConstant}); + })); + + describe('_changeState()', () => { + it('should request to update the ticket state', () => { + let ids = [1, 2, 3, 4]; + let stateId = 1; + let stateName = 'state'; + let index = []; + controller.tickets = ['ticketVal']; + $httpBackend.whenPUT('/production/api/TicketStates/1/changeState', {tickets: ids}).respond({data: 'ticketVal'}); + $httpBackend.expectPUT('/production/api/TicketStates/1/changeState', {tickets: ids}); + controller._changeState(ids, stateId, stateName, index); + $httpBackend.flush(); + }); + }); + }); +}); diff --git a/client/production/src/locale/en.json b/client/production/src/locale/en.json deleted file mode 100644 index bb52c33b6..000000000 --- a/client/production/src/locale/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Production" : "Production" -} \ No newline at end of file diff --git a/client/production/src/locale/en.yml b/client/production/src/locale/en.yml new file mode 100644 index 000000000..2577c6f43 --- /dev/null +++ b/client/production/src/locale/en.yml @@ -0,0 +1 @@ +Production: Production \ No newline at end of file diff --git a/client/production/src/locale/es.json b/client/production/src/locale/es.json deleted file mode 100644 index 0cf5acba5..000000000 --- a/client/production/src/locale/es.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Finder" : "Localizador", - "Production" : "Producción", - "Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!", - "Error: Action not implemented!" : "Error: ¡Acción no implementada!", - "State" : "Estado", - "Alarm" : "Alarma", - "Agencies": "Agencias", - "Agency": "Agencia", - "Store" : "Almacén", - "Printed": "Impreso", - "Commercial": "Comercial", - "Hour" : "Hora", - "Lines" : "Líneas", - "Boxes" : "Cajas", - "Comment" : "Comentario", - "Message" : "Mensaje", - "Send" : "Enviar", - "Date" : "Fecha", - "Ticket ID" : "ID Ticket", - "Route ID": "ID Ruta", - "Province" : "Provincia", - "Filter" : "Filtrar", - "Cancel" : "Cancelar", - "Ticket with incidence" : "Ticket con incidencia" -} \ No newline at end of file diff --git a/client/production/src/locale/es.yml b/client/production/src/locale/es.yml new file mode 100644 index 000000000..7846f4b3d --- /dev/null +++ b/client/production/src/locale/es.yml @@ -0,0 +1,27 @@ +Finder: Localizador +Production: Producción +'Error: No tickets selected!': 'Error: ¡No hay tickets seleccionados!' +'Error: Action not implemented!': 'Error: ¡Acción no implementada!' +State: Estado +Alarm: Alarma +Agencies: Agencias +Agency: Agencia +Store: Almacén +Printed: Impreso +Commercial: Comercial +Hour: Hora +Lines: Líneas +Boxes: Cajas +Comment: Comentario +Message: Mensaje +Send: Enviar +Date: Fecha +Ticket ID: ID Ticket +Route ID: ID Ruta +Province: Provincia +Filter: Filtrar +Cancel: Cancelar +Worker: Trabajador +Town: Población +Client ID: ID Cliente +Ticket with incidence: Ticket con incidencia \ No newline at end of file diff --git a/client/production/src/production-actions/production-actions.html b/client/production/src/production-actions/production-actions.html index 4786d9136..0e79e3b4a 100644 --- a/client/production/src/production-actions/production-actions.html +++ b/client/production/src/production-actions/production-actions.html @@ -1,15 +1,15 @@ - + - + - + \ No newline at end of file diff --git a/client/production/src/production-actions/production-actions.js b/client/production/src/production-actions/production-actions.js index 0e5482f30..fee7b687b 100644 --- a/client/production/src/production-actions/production-actions.js +++ b/client/production/src/production-actions/production-actions.js @@ -35,45 +35,35 @@ export default class ProductionActions { return this._actionWorker; } - _changeState(ids, sateteId, stateName, index) { - this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then( + _changeState(ids, sateteId) { + this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}) + .then( () => { - index.forEach( - i => { - this.tickets[i].state = stateName; - this.tickets[i].stateFk = sateteId; - } - ); + this.parent.searchTickets(); } ); } _sendMessage(tickets) { - this.$http.post(`/production/api/FakeProductions/messageSend`, {tickets: tickets}).then( - () => { - this.vnApp.showMessage(this.$translate.instant('Success: message send!')); - } - ); + this.$http.post(`/production/api/FakeProductions/messageSend`, {tickets: tickets}) + .then( + () => { + this.vnApp.showMessage(this.$translate.instant('Success: message send!')); + } + ); } _changeTime(ids, time, index) { - this.$http.put(`/production/api/Tickets/${time}/changeTime`, {tickets: ids}).then( + this.$http.put(`/production/api/Tickets/${time}/changeTime`, {tickets: ids}) + .then( () => { - index.forEach( - i => { - this.tickets[i].hour = time; - } - ); + this.parent.searchTickets(); } ); } _changeWorker(ids, workerFk, index) { - this.$http.put(`/production/api/Tickets/${workerFk}/changeWorker`, {tickets: ids}).then( + this.$http.put(`/production/api/Tickets/${workerFk}/changeWorker`, {tickets: ids}) + .then( () => { - index.forEach( - i => { - this.tickets[i].workerFk = this.actionWorker.id; - this.tickets[i].worker = this.actionWorker.name; - } - ); + this.parent.searchTickets(); } ); } @@ -82,7 +72,7 @@ export default class ProductionActions { let ids = []; let index = []; let tickets = []; - this.tickets.forEach( + this.parent.tickets.forEach( (val, i) => { if (val.checked) { ids.push(val.ticketFk); @@ -94,13 +84,13 @@ export default class ProductionActions { if (tickets.length) { switch (actionName) { case 'changeState' : - this._changeState(ids, this.actionState.id, this.actionState.name, index); + this._changeState(ids, this.actionState.id); break; case 'addComment': this._sendMessage(tickets); break; case 'markPrinted': - this._changeState(ids, 4, 'Impreso', index); + this._changeState(ids, 4); break; case 'changeTime': this._changeTime(ids, this.actionHours.name, index); @@ -121,10 +111,8 @@ ProductionActions.$inject = ['$http', '$translate', 'vnApp']; ngModule.component('vnProductionActions', { template: require('./production-actions.html'), - bindings: { - tickets: '<', - states: '<', - hourItems: '<' - }, - controller: ProductionActions + controller: ProductionActions, + require: { + parent: '^^vnProductionIndex' + } }); diff --git a/client/production/src/production-table/production-table.html b/client/production/src/production-table/production-table.html index 42a9e45ac..e87410722 100644 --- a/client/production/src/production-table/production-table.html +++ b/client/production/src/production-table/production-table.html @@ -8,6 +8,7 @@ + @@ -16,7 +17,7 @@ - + @@ -27,8 +28,9 @@ {{::ticket.agency}} {{::ticket.routeFk}} {{::ticket.salesPerson | ucwords}} - {{ticket.hour}} - {{ticket.state}} + {{::ticket.worker | ucwords}} + {{::ticket.hour}} + {{::ticket.state}} {{::ticket.lines}} {{::ticket.m3}} {{::ticket.boxes}} @@ -44,10 +46,15 @@ : {{$ctrl.footer.total}} - + + + + + + {{$ctrl.footer.lines}} {{$ctrl.footer.meters}} - + diff --git a/client/production/src/production-table/production-table.js b/client/production/src/production-table/production-table.js index 91c24314f..288118a0d 100644 --- a/client/production/src/production-table/production-table.js +++ b/client/production/src/production-table/production-table.js @@ -13,6 +13,8 @@ export class ProductionTable { }, model: [] }; + this.filteredField = null; + this.filteredReverse = null; } get checkAll() { return this._checkAll; @@ -21,7 +23,7 @@ export class ProductionTable { this._checkAll = value; } set tickets(value) { - this._tickets = value; + this._tickets = this.filteredField ? this.$filter('orderBy')(value, this.filteredField, this.filteredReverse) : value; this.totalFilter = this._tickets.length; this.pageTable.filter.page = 1; this.pageTickets(); @@ -30,8 +32,9 @@ export class ProductionTable { return this._tickets; } onOrder(field, order) { - let reverse = order === 'DESC'; - this.tickets = this.$filter('orderBy')(this.tickets, field, reverse); + this.filteredField = field; + this.filteredReverse = order === 'DESC'; + this.tickets = this.tickets; // call tickets setter } pageTickets() { let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList; diff --git a/client/route/routes.json b/client/route/routes.json index 38659dd17..9e7c48833 100644 --- a/client/route/routes.json +++ b/client/route/routes.json @@ -14,7 +14,7 @@ "url": "/list", "state": "routes.index", "component": "vn-route-index", - "acl": ["employee"] + "acl": ["developer"] }, { "url": "/create", diff --git a/client/route/src/card/card.html b/client/route/src/card/card.html index c87155a74..b787b738f 100644 --- a/client/route/src/card/card.html +++ b/client/route/src/card/card.html @@ -4,7 +4,7 @@ actions="$ctrl.route = edit.model" options="mgEdit"> - + @@ -19,7 +19,7 @@ - + diff --git a/client/route/src/locale/en.json b/client/route/src/locale/en.json deleted file mode 100644 index ff0fd857e..000000000 --- a/client/route/src/locale/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Routes" : "Routes" -} diff --git a/client/route/src/locale/en.yml b/client/route/src/locale/en.yml new file mode 100644 index 000000000..6659ba5dc --- /dev/null +++ b/client/route/src/locale/en.yml @@ -0,0 +1 @@ +Routes: Routes \ No newline at end of file diff --git a/client/route/src/locale/es.json b/client/route/src/locale/es.json deleted file mode 100644 index 1c2b2f4c4..000000000 --- a/client/route/src/locale/es.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "Basic data": "Datos básicos", - "Logistic data": "Datos logísticos", - "Assigned tickets": "Tickets asignados", - "Routes" : "Rutas", - "Route" : "Ruta", - "Date": "Fecha", - "Agency": "Agencia", - "Driver": "Conductor", - "Vehicle": "Vehículo", - "Start Hour" : "Hora Inicio", - "End Hour": "Hora Fin", - "Start Km": "Km Inicio", - "End Km": "Km Fin", - "Packages": "Bultos", - "Route document": "Documento de Ruta" -} diff --git a/client/route/src/locale/es.yml b/client/route/src/locale/es.yml new file mode 100644 index 000000000..4805a41e6 --- /dev/null +++ b/client/route/src/locale/es.yml @@ -0,0 +1,15 @@ +Basic data: Datos básicos +Logistic data: Datos logísticos +Assigned tickets: Tickets asignados +Routes: Rutas +Route: Ruta +Date: Fecha +Agency: Agencia +Driver: Conductor +Vehicle: Vehículo +Start Hour: Hora Inicio +End Hour: Hora Fin +Start Km: Km Inicio +End Km: Km Fin +Packages: Bultos +Route document: Documento de Ruta diff --git a/client/route/src/logistic-data/logistic-data.html b/client/route/src/logistic-data/logistic-data.html index 68bd3311d..9ea4c802b 100644 --- a/client/route/src/logistic-data/logistic-data.html +++ b/client/route/src/logistic-data/logistic-data.html @@ -1,24 +1,23 @@ + form="form">
- Logistic data - - - - - - - - - - - + Logistic data + + + + + + + + + + + diff --git a/client/route/src/search-panel/locale/es.json b/client/route/src/search-panel/locale/es.json deleted file mode 100644 index 1dc7b850f..000000000 --- a/client/route/src/search-panel/locale/es.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Client id": "Id cliente", - "Tax number": "NIF/CIF", - "Name": "Nombre", - "Social name": "Razon social", - "Town/City": "Ciudad", - "Postcode": "Código postal", - "Email": "Correo electrónico", - "Phone": "Teléfono" -} \ No newline at end of file diff --git a/client/route/src/search-panel/locale/es.yml b/client/route/src/search-panel/locale/es.yml new file mode 100644 index 000000000..590d0e6d8 --- /dev/null +++ b/client/route/src/search-panel/locale/es.yml @@ -0,0 +1,8 @@ +Client id: Id cliente +Tax number: NIF/CIF +Name: Nombre +Social name: Razon social +Town/City: Ciudad +Postcode: Código postal +Email: Correo electrónico +Phone: Teléfono \ No newline at end of file diff --git a/client/route/src/search-panel/search-panel.html b/client/route/src/search-panel/search-panel.html index a262c06b8..126b7ca9d 100644 --- a/client/route/src/search-panel/search-panel.html +++ b/client/route/src/search-panel/search-panel.html @@ -10,12 +10,10 @@ order="printingOrder ASC" > - - diff --git a/client/salix/package.json b/client/salix/package.json deleted file mode 100644 index 97df134f1..000000000 --- a/client/salix/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@salix/salix", - "version": "0.0.0", - "description": "", - "main": "index.js", - "repository": { - "type": "git", - "url": "http://git.verdnatura.es:/salix" - } -} diff --git a/client/salix/src/app.js b/client/salix/src/app.js index a4b45629e..5695d02b5 100644 --- a/client/salix/src/app.js +++ b/client/salix/src/app.js @@ -1,5 +1,4 @@ import './module'; -import './spliting'; import './configroutes'; import './config'; import './run'; diff --git a/client/salix/src/components/app/app.html b/client/salix/src/components/app/app.html index 959cf4282..0a447851f 100644 --- a/client/salix/src/components/app/app.html +++ b/client/salix/src/components/app/app.html @@ -1,12 +1,12 @@ - + - + diff --git a/client/salix/src/components/left-menu/actions.js b/client/salix/src/components/left-menu/actions.js index 4d4d6ee6d..30d379df1 100644 --- a/client/salix/src/components/left-menu/actions.js +++ b/client/salix/src/components/left-menu/actions.js @@ -9,7 +9,7 @@ export default class MenuActions { switchItem() { if (!this.items || !this.items.length) return; - let stateName = this.$state.current.name.replace('create', 'list').replace('edit', 'list'); + let stateName = this.$state.current.name.replace('.create', '.list').replace('.edit', '.list'); for (let i = 0; i < this.items.length; i++) { this.items[i].active = (this.items[i].href === stateName); diff --git a/client/salix/src/components/searchbar/searchbar.html b/client/salix/src/components/searchbar/searchbar.html index d4636aaf1..e54a00ccd 100644 --- a/client/salix/src/components/searchbar/searchbar.html +++ b/client/salix/src/components/searchbar/searchbar.html @@ -1,10 +1,10 @@ - + diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 2f0864bf7..06d572f33 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -1,21 +1,67 @@ import ngModule from '../../module'; export default class Controller { - constructor($element, $scope, $document, $compile, vnPopover, sessionStorage, $timeout) { + constructor($element, $scope, $document, $compile, vnPopover, $timeout) { this.element = $element[0]; this.$scope = $scope; this.$document = $document; this.$compile = $compile; this.vnPopover = vnPopover; - this.sessionStorage = sessionStorage; this.$timeout = $timeout; + this.stringSearch = ''; } clearFilter() { - this.index.filter = {}; - this.sessionStorage.remove('filter'); + this.index.filter = { + page: 1, + size: 20 + }; } - onClick(event) { - this.search = null; + // string search to json filter + getFiltersFromSearch() { + let toFind = this.stringSearch; + let find; + if (this.stringSearch) { + // find pattern key:value or key:(extra value) and returns array + find = toFind.match(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi); + // remove pattern key:value or key:(extra value) from string and returns string + this.index.filter.search = (toFind.replace(/((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi, '')).trim(); + if (find) + for (let i = 0; i < find.length; i++) { + let aux = find[i].split(':'); + let property = aux[0]; + let value = aux[1].replace(/\(|\)/g, ''); + this.index.filter[property] = value.trim(); + } + } + } + // json filter to string search + createFilterSearch(filter) { + let search = []; + let keys = Object.keys(filter); + if (keys.length) { + keys.forEach(k => { + let ignore = (this.ignoreKeys && this.ignoreKeys instanceof Array && this.ignoreKeys.indexOf(k) !== -1); + if (!ignore) { + let value = filter[k]; + + if (typeof value === 'string' && value.indexOf(' ') !== -1) { + search.push(`${k}:(${value})`); + } else if (typeof value !== 'object') { + search.push(`${k}:${value}`); + } + } + }); + } + if (this.index.filter.search) { + search.push(this.index.filter.search); + } + delete this.index.filter.search; + this.stringSearch = (search.length) ? search.join(' ') : ''; + } + onpenFilters(event) { + if (this.stringSearch) { + this.getFiltersFromSearch(); + } this.child = this.vnPopover.showComponent(this.popover, this.$scope, this.element); @@ -23,16 +69,26 @@ export default class Controller { var childCtrl = angular.element(this.child).isolateScope().$ctrl; childCtrl.filter = Object.assign({}, this.index.filter); childCtrl.onSubmit = filter => this.onChildSubmit(filter); - + if (this.data) + childCtrl.data = Object.assign({}, this.data); event.preventDefault(); } onChildSubmit(filter) { - // this.vnPopover.hide(); - Object.assign(this.index.filter, filter); - this.onSubmit(); + this.createFilterSearch(filter); + this.index.filter = { + page: 1, + size: 20 + }; + this.$timeout(() => { + this.onSubmit(); + }); } onSubmit() { + if (this.stringSearch) { + this.getFiltersFromSearch(); + } + if (this.onSearch) this.onSearch(); @@ -47,17 +103,18 @@ export default class Controller { this.clearFilter(); } } -Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', 'sessionStorage', '$timeout']; +Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', '$timeout']; ngModule.component('vnSearchbar', { template: require('./searchbar.html'), bindings: { index: '<', - search: '=', onSearch: '&', advanced: '=', popover: '@', - label: '@?' + label: '@?', + ignoreKeys: '`, resolve: { loader: loader(moduleName, validations) @@ -57,7 +58,13 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF data: { routes: fileRoutes } - }); + }; + if (route.abstract) + configRoute.abstract = true; + if (route.routeParams) + configRoute.params = route.routeParams; + + $stateProvider.state(route.state, configRoute); } else if (route.state === mainModule.state) { break; } diff --git a/client/salix/src/locale/en.json b/client/salix/src/locale/en.json deleted file mode 100644 index d24ba5e4d..000000000 --- a/client/salix/src/locale/en.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Applications": "Applications", - "Home": "Home", - "Notifications":"Notifications", - "Logout": "Logout", - "Change language": "Change language", - "Profile": "Profile", - "Data saved!": "Data saved!", - "Can't contact with server": "Can't contact with server", - "Push on applications menu": "To open a module push on applications menu", - "Clients": "Clients", - "Modules access": "Modules access" -} \ No newline at end of file diff --git a/client/salix/src/locale/en.yml b/client/salix/src/locale/en.yml new file mode 100644 index 000000000..fbae9a742 --- /dev/null +++ b/client/salix/src/locale/en.yml @@ -0,0 +1,11 @@ +Applications: Applications +Home: Home +Notifications: Notifications +Logout: Logout +Change language: Change language +Profile: Profile +Data saved!: Data saved! +Can't contact with server: Can't contact with server +Push on applications menu: To open a module push on applications menu +Clients: Clients +Modules access: Modules access \ No newline at end of file diff --git a/client/salix/src/locale/es.json b/client/salix/src/locale/es.json deleted file mode 100644 index a5f88410b..000000000 --- a/client/salix/src/locale/es.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "Applications": "Aplicaciones", - "Home": "Inicio", - "Notifications":"Notificaciones", - "Logout": "Cerrar sesión", - "Change language": "Cambiar idioma", - "Profile": "Perfil", - "Data saved!": "¡Datos guardados!", - "Can't contact with server": "No se pudo contactar con el servidor", - "Push on applications menu": "Para abrir un módulo pulsa en el menú de aplicaciones", - "Clients": "Clientes", - "Routes" : "Rutas", - "Production" : "Producción", - "Modules access" : "Acceso a módulos", - "Locator": "Localizador" -} \ No newline at end of file diff --git a/client/salix/src/locale/es.yml b/client/salix/src/locale/es.yml new file mode 100644 index 000000000..b02124c21 --- /dev/null +++ b/client/salix/src/locale/es.yml @@ -0,0 +1,19 @@ +Applications: Aplicaciones +Home: Inicio +Notifications: Notificaciones +Logout: Cerrar sesión +Change language: Cambiar idioma +Profile: Perfil +Data saved!: ¡Datos guardados! +Can't contact with server: No se pudo contactar con el servidor +Push on applications menu: Para abrir un módulo pulsa en el menú de aplicaciones +Clients: Clientes +Routes : Rutas +Production : Producción +Modules access : Acceso a módulos +Locator: Localizador +Items: Artículos +name: Nombre +credit: Crédito +phone: Teléfono +creditInsurance: Crédito Asegurado \ No newline at end of file diff --git a/client/salix/src/spliting.js b/client/salix/src/spliting.js deleted file mode 100644 index 697bcef98..000000000 --- a/client/salix/src/spliting.js +++ /dev/null @@ -1,45 +0,0 @@ -import * as core from 'core'; - -export const client = () => { - return new Promise(resolve => { - require.ensure([], () => { - require('client'); - resolve('client'); - }, 'client'); - }); -}; - -core.splitingRegister.register('client', client); - -export const production = () => { - return new Promise(resolve => { - require.ensure([], () => { - require('production'); - resolve('production'); - }, 'production'); - }); -}; - -core.splitingRegister.register('production', production); - -export const route = () => { - return new Promise(resolve => { - require.ensure([], () => { - require('route'); - resolve('route'); - }, 'route'); - }); -}; - -core.splitingRegister.register('route', route); - -export const locator = () => { - return new Promise(resolve => { - require.ensure([], () => { - require('locator'); - resolve('locator'); - }, 'locator'); - }); -}; - -core.splitingRegister.register('locator', locator); diff --git a/client/salix/src/styles/border.scss b/client/salix/src/styles/border.scss index 3eb08176d..bd046c559 100644 --- a/client/salix/src/styles/border.scss +++ b/client/salix/src/styles/border.scss @@ -1,45 +1,51 @@ -@import "colors"; - -$border-color: #AAA; -$border-thin: 1px; -$border-thick: 2px; - -html [border-none], .border-none { - border: 0; -} - -/* Solid border */ - -html [border-solid], .border-solid { - border: $border-thin solid $border-color; -} -html [border-solid-top], .border-solid-top { - border-top: $border-thin solid $border-color; -} -html [border-solid-left], .border-solid-left { - border-left: $border-thin solid $border-color; -} -html [border-solid-right], .border-solid-right { - border-right: $border-thin solid $border-color; -} -html [border-solid-bottom], .border-solid-bottom { - border-bottom: $border-thin solid $border-color; -} - -/* Dashed border */ - -html [border-dashed], .border-dashed { - border: $border-thin dashed $border-color; -} -html [border-dashed-top], .border-dashed-top { - border-top: $border-thin dashed $border-color; -} -html [border-dashed-left], .border-dashed-left { - border-left: $border-thin dashed $border-color; -} -html [border-dashed-right], .border-dashed-right { - border-right: $border-thin dashed $border-color; -} -html [border-dashed-bottom], .border-dashed-bottom { - border-bottom: $border-thin dashed $border-color; -} +@import "colors"; + +$border-color: #AAA; +$border-thin: 1px; +$border-thick: 2px; + +html [border-none], .border-none { + border: 0; +} + +/* Solid border */ + +html [border-solid], .border-solid { + border: $border-thin solid $border-color; +} +html [border-solid-top], .border-solid-top { + border-top: $border-thin solid $border-color; +} +html [border-solid-left], .border-solid-left { + border-left: $border-thin solid $border-color; +} +html [border-solid-right], .border-solid-right { + border-right: $border-thin solid $border-color; +} +html [border-solid-bottom], .border-solid-bottom { + border-bottom: $border-thin solid $border-color; +} + +/* Dashed border */ + +html [border-dashed], .border-dashed { + border: $border-thin dashed $border-color; +} +html [border-dashed-top], .border-dashed-top { + border-top: $border-thin dashed $border-color; +} +html [border-dashed-left], .border-dashed-left { + border-left: $border-thin dashed $border-color; +} +html [border-dashed-right], .border-dashed-right { + border-right: $border-thin dashed $border-color; +} +html [border-dashed-bottom], .border-dashed-bottom { + border-bottom: $border-thin dashed $border-color; +} + +/* Border Radius */ + +html [border-radius], .border-radius { + border-radius: .3em; +} \ No newline at end of file diff --git a/client/salix/src/styles/display.css b/client/salix/src/styles/display.css index 982432252..c296eec69 100644 --- a/client/salix/src/styles/display.css +++ b/client/salix/src/styles/display.css @@ -24,9 +24,9 @@ } .popover-label { - font-weight: bold; - color: black; - padding-top:5px; + font-family: vn-font-bold; + color: black; + padding-top:5px; } /* Icon cuadrado */ diff --git a/client/salix/src/styles/font-family.css b/client/salix/src/styles/font-family.css index 3fc6b8fcd..38a87a3e8 100644 --- a/client/salix/src/styles/font-family.css +++ b/client/salix/src/styles/font-family.css @@ -1,21 +1,12 @@ -@font-face { - font-family: raleway-italic; - src: url(./fonts/Raleway-Italic.ttf); -} -@font-face { - font-family: raleway-thin; - src: url(./fonts/Raleway-Thin.ttf); -} -@font-face { - font-family: raleway-regular; - src: url(./fonts/Raleway-Regular.ttf); -} -@font-face { - font-family: raleway-bold; - src: url(./fonts/Raleway-Bold.ttf); -} -@font-face { - font-family: raleway-semi-bold; - src: url(./fonts/Raleway-SemiBold.ttf); -} - +@font-face { + font-family: vn-font-medium; + src: url(./fonts/Roboto-Medium.ttf); +} +@font-face { + font-family: vn-font; + src: url(./fonts/Roboto-Regular.ttf); +} +@font-face { + font-family: vn-font-bold; + src: url(./fonts/Roboto-Bold.ttf); +} diff --git a/client/salix/src/styles/font-style.scss b/client/salix/src/styles/font-style.scss index fb4b055d3..bb26140ee 100644 --- a/client/salix/src/styles/font-style.scss +++ b/client/salix/src/styles/font-style.scss @@ -1,12 +1,24 @@ -@import "colors"; -@import "font-family"; - -$font-color: $color-dark-grey; - -body { - color: $font-color; - font-family: raleway-regular; -} -html [uppercase], .uppercase { - text-transform: uppercase; -} \ No newline at end of file +@import "colors"; +@import "font-family"; + +$font-color: $color-dark-grey; + +body { + color: $font-color; + font-family: vn-font; +} +html [uppercase], .uppercase { + text-transform: uppercase; +} + +html [green], .green{color: $color-green} +html [orange], .orange{color: $color-orange} +html [white], .white{color: $color-white} +html [dark], .dark{color: $color-dark} +html [dark-grey], .dark-grey{color: $color-dark-grey} +html [light-grey], .light-grey{color: $color-light-grey} +html [medium-grey], .medium-grey{color: $color-medium-grey} +html [medium-green], .medium-green{color: $color-medium-green} +html [medium-orange], .medium-orange{color: $color-medium-orange} +html [light-green], .light-green{color: $color-light-green} +html [light-orange], .light-orange{color: $color-light-orange} \ No newline at end of file diff --git a/client/salix/src/styles/fonts/Raleway-Bold.ttf b/client/salix/src/styles/fonts/Raleway-Bold.ttf deleted file mode 100755 index 38c099cc8..000000000 Binary files a/client/salix/src/styles/fonts/Raleway-Bold.ttf and /dev/null differ diff --git a/client/salix/src/styles/fonts/Raleway-Italic.ttf b/client/salix/src/styles/fonts/Raleway-Italic.ttf deleted file mode 100755 index 237d88d90..000000000 Binary files a/client/salix/src/styles/fonts/Raleway-Italic.ttf and /dev/null differ diff --git a/client/salix/src/styles/fonts/Raleway-Regular.ttf b/client/salix/src/styles/fonts/Raleway-Regular.ttf deleted file mode 100755 index e570a2d5c..000000000 Binary files a/client/salix/src/styles/fonts/Raleway-Regular.ttf and /dev/null differ diff --git a/client/salix/src/styles/fonts/Raleway-SemiBold.ttf b/client/salix/src/styles/fonts/Raleway-SemiBold.ttf deleted file mode 100755 index ed0a8b994..000000000 Binary files a/client/salix/src/styles/fonts/Raleway-SemiBold.ttf and /dev/null differ diff --git a/client/salix/src/styles/fonts/Raleway-Thin.ttf b/client/salix/src/styles/fonts/Raleway-Thin.ttf deleted file mode 100755 index a497b98a8..000000000 Binary files a/client/salix/src/styles/fonts/Raleway-Thin.ttf and /dev/null differ diff --git a/client/salix/src/styles/fonts/Roboto-Bold.ttf b/client/salix/src/styles/fonts/Roboto-Bold.ttf new file mode 100644 index 000000000..d3f01ad24 Binary files /dev/null and b/client/salix/src/styles/fonts/Roboto-Bold.ttf differ diff --git a/client/salix/src/styles/fonts/Roboto-Medium.ttf b/client/salix/src/styles/fonts/Roboto-Medium.ttf new file mode 100644 index 000000000..1a7f3b0bb Binary files /dev/null and b/client/salix/src/styles/fonts/Roboto-Medium.ttf differ diff --git a/client/salix/src/styles/fonts/Roboto-Regular.ttf b/client/salix/src/styles/fonts/Roboto-Regular.ttf new file mode 100644 index 000000000..2c97eeadf Binary files /dev/null and b/client/salix/src/styles/fonts/Roboto-Regular.ttf differ diff --git a/client/salix/src/styles/layout.css b/client/salix/src/styles/layout.css index 1d35fd5c8..c952abe37 100644 --- a/client/salix/src/styles/layout.css +++ b/client/salix/src/styles/layout.css @@ -1,110 +1,106 @@ - -html, body { - height: 100%; - margin: 0px; - padding: 0px; -} - -html [full-height], .full-height { - height: 100%; -} -html [self-scroll], .self-scroll { - overflow: auto; -} - -/* Horizontal & vertical */ - -html [vn-horizontal], vn-horizontal, .vn-horizontal, -html [vn-vertical], vn-vertical, .vn-vertical { - display: flex; -} -html [vn-horizontal], vn-horizontal, .vn-horizontal { - flex-direction: row; -} -vn-horizontal[reverse] { - flex-direction: row-reverse; -} -html [vn-vertical], vn-vertical, .vn-vertical { - flex-direction: column; -} -vn-vertical[reverse] { - flex-direction: column-reverse; -} -html [wrap] { - flex-wrap: wrap; -} -html [wrap-reverse] { - flex-wrap: wrap-reverse; -} -html [scrollable] { - min-height: 1px; - flex: 1; - flex-basis: 0.000000001px; -} - -/* Horizontal & vertical childs */ - -html [vn-auto], -html [vn-none], -html [vn-one], -html [vn-two], -html [vn-three], -html [vn-four], -html [vn-five], -html [vn-six], -html [vn-seven], -html [vn-eight], -html [vn-nine], -html [vn-ten], -html [vn-eleven], -html [vn-twelve]{ - flex-basis: 0.000000001px; -} -html [vn-auto], vn-auto, .vn-auto { - flex: 1; - flex-basis: auto; -} -html [vn-empty], vn-empty, .vn-empty { - display: block; -} -html [vn-none], vn-none, .vn-none { - flex: 1; - flex: none; -} -html [vn-one], vn-one, .vn-one { - flex: 1; -} -html [vn-two], vn-two, .vn-two { - flex: 2; -} -html [vn-three], vn-three, .vn-three { - flex: 3; -} -html [vn-four], vn-four, .vn-four { - flex: 4; -} -html [vn-five], vn-five, .vn-five { - flex: 5; -} -html [vn-six], vn-six, .vn-six { - flex: 6; -} -html [vn-seven], vn-seven, .vn-seven { - flex: 7; -} -html [vn-eight], vn-eight, .vn-eight { - flex: 8; -} -html [vn-nine], vn-nine, .vn-nine { - flex: 9; -} -html [vn-ten], vn-ten, .vn-ten { - flex: 10; -} -html [vn-eleven], vn-eleven, .vn-eleven { - flex: 11; -} -html [vn-twelve], vn-twelve, .vn-twelve { - flex: 12; -} - + +html, body { + height: 100%; + margin: 0px; + padding: 0px; +} + +html [full-height], .full-height { + height: 100%; +} +html [self-scroll], .self-scroll { + overflow: auto; +} + +/* Horizontal & vertical */ + +html [vn-horizontal], vn-horizontal, .vn-horizontal, +html [vn-vertical], vn-vertical, .vn-vertical { + display: flex; +} +html [vn-horizontal], vn-horizontal, .vn-horizontal { + flex-direction: row; +} +vn-horizontal[reverse] { + flex-direction: row-reverse; +} +html [vn-vertical], vn-vertical, .vn-vertical { + flex-direction: column; +} +vn-vertical[reverse] { + flex-direction: column-reverse; +} +html [wrap] { + flex-wrap: wrap; +} +html [wrap-reverse] { + flex-wrap: wrap-reverse; +} +html [scrollable] { + min-height: 1px; + flex: 1; + flex-basis: 0.000000001px; +} + +/* Horizontal & vertical childs */ + +html [vn-auto], +html [vn-none], +html [vn-one], +html [vn-two], +html [vn-three], +html [vn-four], +html [vn-five], +html [vn-six], +html [vn-seven], +html [vn-eight], +html [vn-nine], +html [vn-ten], +html [vn-eleven], +html [vn-twelve]{ + flex-basis: 0.000000001px; +} +html [vn-auto], vn-auto, .vn-auto { + flex-basis: auto; +} +html [vn-none], vn-none, .vn-none { + flex: 1; + flex: none; +} +html [vn-one], vn-one, .vn-one { + flex: 1; +} +html [vn-two], vn-two, .vn-two { + flex: 2; +} +html [vn-three], vn-three, .vn-three { + flex: 3; +} +html [vn-four], vn-four, .vn-four { + flex: 4; +} +html [vn-five], vn-five, .vn-five { + flex: 5; +} +html [vn-six], vn-six, .vn-six { + flex: 6; +} +html [vn-seven], vn-seven, .vn-seven { + flex: 7; +} +html [vn-eight], vn-eight, .vn-eight { + flex: 8; +} +html [vn-nine], vn-nine, .vn-nine { + flex: 9; +} +html [vn-ten], vn-ten, .vn-ten { + flex: 10; +} +html [vn-eleven], vn-eleven, .vn-eleven { + flex: 11; +} +html [vn-twelve], vn-twelve, .vn-twelve { + flex: 12; +} + diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 8168b6781..5138567a0 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -64,7 +64,7 @@ html [vn-center], .vn-center{ .tooltip { .list-header{ border-bottom: 3px solid $color-medium-grey; - font-weight: bold; + font-family: vn-font-bold; text-align: center } .list-element{ @@ -72,7 +72,7 @@ html [vn-center], .vn-center{ } } .list-footer{ - font-weight: bold; + font-family: vn-font-bold; border-top: 3px solid $color-medium-grey; } .list-element.warning{ @@ -95,3 +95,41 @@ html [vn-center], .vn-center{ html [pointer], .pointer{ cursor: pointer; } + +html [noDrop], .noDrop{ + cursor: no-drop; +} + +vn-main-block { + display:block; + max-width: 1920px; + width:100%; + margin: 0 auto; + + .left-block { + max-width: 20em; + min-width: 18em; + padding-left: 1em; + padding-bottom: 1em; + } +} +.descriptor-header{ + background: rgb(255,171,64); + color: white; + text-align: center; + i { + font-size: 51px; + } + img { + width: 51px; + height: 51px; + } +} +fieldset[disabled] .mdl-textfield .mdl-textfield__input, .mdl-textfield.is-disabled .mdl-textfield__input, +fieldset[disabled] .mdl-checkbox .mdl-checkbox__label, .mdl-checkbox.is-disabled .mdl-checkbox__label{ + border: none !important; + color: inherit !important; +} +fieldset[disabled] .mdl-textfield .mdl-textfield__label, .mdl-textfield.is-disabled.is-disabled .mdl-textfield__label { + color: rgb(255,171,64) !important; +} \ No newline at end of file diff --git a/client/salix/src/styles/title.css b/client/salix/src/styles/title.css index 4589f0b9c..1fe3e45ca 100644 --- a/client/salix/src/styles/title.css +++ b/client/salix/src/styles/title.css @@ -1,25 +1,25 @@ - -h1 { - font-size: 32pt; -} -h2 { - font-size: 28pt; -} -h3 { - font-size: 24pt; -} -h4 { - font-size: 20pt; -} -h5 { - font-size: 16pt; -} -h6 { - font-size: 12pt; -} - -h1, h2, h3, h4, h5, h6 { - padding: 0; - margin: .4em 0; - font-family: raleway-semi-bold; + +h1 { + font-size: 32pt; +} +h2 { + font-size: 28pt; +} +h3 { + font-size: 24pt; +} +h4 { + font-size: 20pt; +} +h5 { + font-size: 16pt; +} +h6 { + font-size: 12pt; +} + +h1, h2, h3, h4, h5, h6 { + padding: 0; + margin: .4em 0; + font-family: vn-font-bold; } \ No newline at end of file diff --git a/client/spliting.js b/client/spliting.js new file mode 100644 index 000000000..9d472675f --- /dev/null +++ b/client/spliting.js @@ -0,0 +1,12 @@ +export default { + client: + cb => require.ensure([], () => cb(require('client'))), + production: + cb => require.ensure([], () => cb(require('production'))), + route: + cb => require.ensure([], () => cb(require('route'))), + locator: + cb => require.ensure([], () => cb(require('locator'))), + item: + cb => require.ensure([], () => cb(require('item'))) +}; diff --git a/client/vendor/package.json b/client/vendor/package.json deleted file mode 100644 index dcc92d344..000000000 --- a/client/vendor/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "@salix/vendor", - "version": "0.0.0", - "description": "", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://git.verdnatura.es/salix" - } -} diff --git a/dev.cmd b/dev.cmd deleted file mode 100644 index 9ce10f615..000000000 --- a/dev.cmd +++ /dev/null @@ -1,27 +0,0 @@ -@echo off - -set currentDir=%cd% -set nginxPrefix=%currentDir%\services\nginx -set nginxConf=%nginxPrefix%\conf-dev.conf - -if "%1"=="" goto caseStart -if "%1"=="start" goto caseStart -if "%1"=="stop" goto caseStop -goto caseUsage - -:caseStart - call "%0" stop - echo Starting nginx. - if not exist "%nginxPrefix%\temp" (mkdir "%nginxPrefix%\temp") - start /I nginx -c "%nginxConf%" -p "%nginxPrefix%" - goto caseEnd - -:caseStop - echo Stoping nginx. - if exist "%nginxPrefix%\temp\nginx.pid" (nginx -c "%nginxConf%" -p "%nginxPrefix%" -s stop) - goto caseEnd - -:caseUsage - echo "Usage: %0 [start|stop]" - -:caseEnd diff --git a/dev.sh b/dev.sh deleted file mode 100755 index 1047788fb..000000000 --- a/dev.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -nginxBin="/usr/sbin/nginx" -nginxPrefix="${PWD}/services/nginx" -nginxConf="$nginxPrefix/conf-dev.conf" - -if [ ! -f $nginxBin ]; then - nginxBin="nginx" -fi - -case "$1" in - start|"") - $0 stop - echo "Starting nginx." - mkdir -p "$nginxPrefix/temp" - "$nginxBin" -c "$nginxConf" -p "$nginxPrefix" 2>> /dev/null - ;; - stop) - echo "Stoping nginx." - "$nginxBin" -c "$nginxConf" -p "$nginxPrefix" -s stop 2>> /dev/null - ;; - *) - echo "Usage: `basename "$0"` [start|stop]" - exit 1 -esac diff --git a/docker-compose.tpl.yml b/docker-compose.tpl.yml new file mode 100644 index 000000000..1777118a7 --- /dev/null +++ b/docker-compose.tpl.yml @@ -0,0 +1,12 @@ +version: '2' +services: + nginx: + container_name: "${BRANCH_NAME}-nginx" + image: "nginx:${TAG}" + privileged: true + build: + context: ./services/nginx + ports: + - "80:80" + mem_limit: 200m + links: [] diff --git a/e2e/helpers/components_selectors.js b/e2e/helpers/components_selectors.js index 87dc22c69..4b33bce61 100644 --- a/e2e/helpers/components_selectors.js +++ b/e2e/helpers/components_selectors.js @@ -4,6 +4,7 @@ // delete me, this comment is to add a commit export default { vnTextfield: 'vn-textfield > div > input', + vnTextarea: 'vn-textarea', vnSubmit: 'vn-submit > input', vnTopbar: 'vn-topbar > header', vnIcon: 'vn-icon', @@ -14,5 +15,6 @@ export default { vnFloatButton: 'vn-float-button > button', vnMenuItem: 'vn-menu-item > li > a', vnAutocomplete: 'vn-autocomplete', - vnCheck: 'vn-check' + vnCheck: 'vn-check', + vnIconButton: 'vn-icon-button' }; diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 168540de4..a90d4f410 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -122,11 +122,27 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) { Nightmare.action('waitForTextInElement', function(selector, name, done) { this.wait((resultSelector, expectedName) => { - return document.querySelectorAll(resultSelector)[0].innerText.toLowerCase().includes(expectedName.toLowerCase()); + return document.querySelector(resultSelector).innerText.toLowerCase().includes(expectedName.toLowerCase()); }, selector, name) .then(done); }); +Nightmare.action('changeLanguageToEnglish', function(done) { + this.wait(selectors.globalItems.languageButton) + .evaluate(selector => { + return document.querySelector(selector).title; + }, selectors.globalItems.languageButton) + .then(result => { + if (result === 'Cambiar idioma') { + this.click(selectors.globalItems.languageButton) + .then(done); + } + if (result === 'Change language') { + this.then(done); + } + }); +}); + Nightmare.action('waitForSnackbarReset', function(done) { this.wait(() => { return document.querySelector('vn-snackbar').innerText === ''; diff --git a/e2e/helpers/nightmare.js b/e2e/helpers/nightmare.js index 7427ac18f..4b524eb02 100644 --- a/e2e/helpers/nightmare.js +++ b/e2e/helpers/nightmare.js @@ -1,19 +1,23 @@ /* eslint no-console: 0 */ import Nightmare from 'nightmare'; -export default function createNightmare(width = 1100, height = 600) { - const nightmare = new Nightmare({show: true, typeInterval: 10}).viewport(width, height); +export default function createNightmare(width = 1280, height = 720) { + const nightmare = new Nightmare({show: true, typeInterval: 10, x: 0, y: 0}).viewport(width, height); - nightmare.on('page', function(type, message, error) { + nightmare.on('page', (type, message, error) => { fail(error); }); - nightmare.on('console', function(type, message) { + nightmare.on('dom-ready', function() { + nightmare.inject('js', `${__dirname}/nightmareModifiers.js`); + }); + + nightmare.on('console', (type, message) => { if (type === 'error') { fail(message); } if (type === 'log') { - console.log(message); + // console.log(message); } }); return nightmare; diff --git a/e2e/helpers/nightmareModifiers.js b/e2e/helpers/nightmareModifiers.js new file mode 100644 index 000000000..3636533d8 --- /dev/null +++ b/e2e/helpers/nightmareModifiers.js @@ -0,0 +1,2 @@ +// snackbar default 2500 and jasmine timeout should be 10000 +window.snackbarTimeout = 400; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index fb968e2d7..2aaa6ddd4 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -10,6 +10,7 @@ export default { globalItems: { topBar: `${components.vnTopbar}`, logOutButton: `${components.vnIcon}[icon="exit_to_app"]`, + languageButton: `${components.vnIcon}[icon="language"]`, snackbarIsActive: '.mdl-snackbar--active > .mdl-snackbar__text', applicationsMenuButton: `${components.vnIcon}[icon="apps"]`, applicationsMenuVisible: `${components.vnMainMenu} .is-visible > div`, @@ -30,35 +31,112 @@ export default { socialName: `${components.vnTextfield}[name="socialName"]`, userName: `${components.vnTextfield}[name="userName"]`, email: `${components.vnTextfield}[name="email"]`, + salesPersonInput: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"] > vn-vertical > ${components.vnTextfield}`, + salesBruceBannerOption: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, createButton: `${components.vnSubmit}` }, basicData: { basicDataButton: `${components.vnMenuItem}[ui-sref="clientCard.basicData"]`, nameInput: `${components.vnTextfield}[name="name"]`, - taxNumberInput: `${components.vnTextfield}[name="fi"]`, - socialNameInput: `${components.vnTextfield}[name="socialName"]`, + contactInput: `${components.vnTextfield}[name="contact"]`, phoneInput: `${components.vnTextfield}[name="phone"]`, mobileInput: `${components.vnTextfield}[name="mobile"]`, faxInput: `${components.vnTextfield}[name="fax"]`, emailInput: `${components.vnTextfield}[name="email"]`, - salesPersonInput: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"]`, + salesPersonInput: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"] > vn-vertical > ${components.vnTextfield}`, + salesBruceBannerOption: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, channelInput: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > ${components.vnTextfield}`, - channelMetropolisOption: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)`, + channelMetropolisOption: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(3)`, saveButton: `${components.vnSubmit}` }, fiscalData: { fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`, - hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`, - hasToInvoiceCheckboxInput: `${components.vnCheck}[label='Has to invoice'] > label > label > input`, - invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`, - invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`, + socialNameInput: `${components.vnTextfield}[name="socialName"]`, + fiscalIdInput: `${components.vnTextfield}[name="fi"]`, + equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, + acceptPropagationButton: `body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(2)`, addressInput: `${components.vnTextfield}[name="street"]`, cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, provinceInput: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > ${components.vnTextfield}`, - provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(5)`, + provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(5)`, countryInput: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > ${components.vnTextfield}`, - countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(3) > ul > li:nth-child(3)`, + countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(3)`, + activeCheckboxLabel: `${components.vnCheck}[label='Active'] > label`, + invoiceByAddressCheckboxInput: `${components.vnCheck}[label='Invoice by address'] > label > input`, + verifiedDataCheckboxInput: `${components.vnCheck}[label='Verified data'] > label > input`, + hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`, + invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`, + viesCheckboxInput: `${components.vnCheck}[label='Vies'] > label > input`, saveButton: `${components.vnSubmit}` + }, + payMethod: { + payMethodButton: `${components.vnMenuItem}[ui-sref="clientCard.billingData"]`, + payMethodInput: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > ${components.vnTextfield}`, + payMethodIBANOption: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(5)`, + payMethodOptionOne: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + IBANInput: `${components.vnTextfield}[name="iban"]`, + dueDayInput: `${components.vnTextfield}[name="dueDay"]`, + cancelNotificationButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-billing-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)', + receivedCoreVNHCheckbox: `${components.vnCheck}[label='Received core VNH'] > label > input`, + receivedCoreVNLCheckbox: `${components.vnCheck}[label='Received core VNL'] > label > input`, + receivedB2BVNLCheckbox: `${components.vnCheck}[label='Received B2B VNL'] > label > input`, + saveButton: `${components.vnSubmit}` + }, + addresses: { + addressesButton: `${components.vnMenuItem}[ui-sref="clientCard.addresses.list"]`, + createAddress: `${components.vnFloatButton}`, + defaultCheckboxInput: `${components.vnCheck}[label='Default'] > label > input`, + consigneeInput: `${components.vnTextfield}[name="nickname"]`, + streetAddressInput: `${components.vnTextfield}[name="street"]`, + postcodeInput: `${components.vnTextfield}[name="postcode"]`, + cityInput: `${components.vnTextfield}[name="city"]`, + provinceInput: `${components.vnAutocomplete}[field="$ctrl.address.provinceFk"] > vn-vertical > ${components.vnTextfield}`, + provinceSecondOption: `${components.vnAutocomplete}[field="$ctrl.address.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + agencyInput: `${components.vnAutocomplete}[field="$ctrl.address.agencyFk"] > vn-vertical > ${components.vnTextfield}`, + agenctySecondOption: `${components.vnAutocomplete}[field="$ctrl.address.agencyFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + phoneInput: `${components.vnTextfield}[name="phone"]`, + mobileInput: `${components.vnTextfield}[name="mobile"]`, + defaultAddress: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one > vn-horizontal > vn-one > div:nth-child(2)', + secondMakeDefaultStar: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > vn-horizontal > vn-none > i', + firstEditButton: `${components.vnIconButton}[icon='edit']`, + secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`, + activeCheckbox: `${components.vnCheck}[label='Enabled'] > label > input`, + equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, + saveButton: `${components.vnSubmit}` + }, + webAccess: { + webAccessButton: `${components.vnMenuItem}[ui-sref="clientCard.webAccess"]`, + enableWebAccessCheckbox: `${components.vnCheck}[label='Enable web access'] > label > input`, + userNameInput: `${components.vnTextfield}[name="name"]`, + saveButton: `${components.vnSubmit}` + }, + notes: { + notesButton: `${components.vnMenuItem}[ui-sref="clientCard.notes.list"]`, + addNoteFloatButton: `${components.vnFloatButton}`, + noteInput: `${components.vnTextarea}[label="Note"]`, + saveButton: `${components.vnSubmit}`, + firstNoteText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-notes > vn-card > div > vn-vertical > vn-one:nth-child(2) > vn-horizontal:nth-child(2) > b' + }, + credit: { + creditButton: `${components.vnMenuItem}[ui-sref="clientCard.credit.list"]`, + addCreditFloatButton: `${components.vnFloatButton}`, + creditInput: `${components.vnTextfield}[name="credit"]`, + saveButton: `${components.vnSubmit}`, + firstCreditText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-credit-list > vn-card > div > vn-vertical > vn-one > vn-horizontal:nth-child(1) > vn-one' + }, + greuge: { + greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`, + addGreugeFloatButton: `${components.vnFloatButton}`, + amountInput: `${components.vnTextfield}[name="amount"]`, + descriptionInput: `${components.vnTextfield}[name="description"]`, + typeInput: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > ${components.vnTextfield}`, + typeSecondOption: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-auto:nth-child(2) > ul > li`, + saveButton: `${components.vnSubmit}`, + firstGreugeText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-greuge-list > vn-card > div > vn-vertical > vn-one > vn-horizontal' + }, + mandate: { + mandateButton: `${components.vnMenuItem}[ui-sref="clientCard.mandate"]`, + firstMandateText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-mandate > vn-card > div > vn-vertical > vn-one > vn-horizontal' } }; diff --git a/e2e/paths/create_client_path.spec.js b/e2e/paths/01_create_client_path.spec.js similarity index 84% rename from e2e/paths/create_client_path.spec.js rename to e2e/paths/01_create_client_path.spec.js index b9107bf2c..48dd08a77 100644 --- a/e2e/paths/create_client_path.spec.js +++ b/e2e/paths/01_create_client_path.spec.js @@ -5,20 +5,9 @@ import {catchErrors} from '../../services/utils/jasmineHelpers'; const nightmare = createNightmare(); const moduleAccessViewHashURL = '#!/'; -describe('create client path', () => { - describe('warm up', () => { - it('should warm up login and fixtures', done => { - nightmare - .login() - .waitForURL(moduleAccessViewHashURL) - .waitToClick(selectors.globalItems.logOutButton) - .then(() => { - done(); - }) - .catch(catchErrors(done)); - }); - }); +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; +describe('create client path', () => { it('should log in', done => { nightmare .login() @@ -31,6 +20,15 @@ describe('create client path', () => { .catch(catchErrors(done)); }); + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + it('should access to the clients index by clicking the clients button', done => { nightmare .click(selectors.moduleAccessView.clientsSectionButton) @@ -75,7 +73,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('No hay cambios que guardar'); + expect(result).toEqual('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -89,7 +87,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`Error: La instancia`); + expect(result).toContain('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -104,7 +102,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`Error: La instancia`); + expect(result).toContain('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -119,7 +117,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`Error: La instancia`); + expect(result).toContain('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -134,7 +132,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`Error: La instancia`); + expect(result).toContain('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -149,7 +147,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`Algunos campos no son válidos`); + expect(result).toEqual('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -164,7 +162,22 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`Error: La instancia`); + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the create button having all the form fields empty but sales person', done => { + nightmare + .waitToClick(selectors.createClientView.salesPersonInput) + .waitToClick(selectors.createClientView.salesBruceBannerOption) + .wait(200) + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); done(); }) .catch(catchErrors(done)); @@ -184,7 +197,7 @@ describe('create client path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toContain(`¡Datos guardados!`); + expect(result).toContain('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -218,4 +231,3 @@ describe('create client path', () => { .catch(catchErrors(done)); }); }); - diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/02_edit_basic_data.spec.js similarity index 67% rename from e2e/paths/edit_basic_data.spec.js rename to e2e/paths/02_edit_basic_data.spec.js index 8fcd7dca1..ef8a6b388 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/02_edit_basic_data.spec.js @@ -5,20 +5,9 @@ import {catchErrors} from '../../services/utils/jasmineHelpers'; const nightmare = createNightmare(); const moduleAccessViewHashURL = '#!/'; -describe('Edit basicData path', () => { - describe('warm up', () => { - it('should warm up login and fixtures', done => { - nightmare - .login() - .waitForURL(moduleAccessViewHashURL) - .waitToClick(selectors.globalItems.logOutButton) - .then(() => { - done(); - }) - .catch(catchErrors(done)); - }); - }); +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; +describe('Edit basicData path', () => { it('should log in', done => { nightmare .login() @@ -31,6 +20,15 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + it('should click on the Clients button of the top bar menu', done => { nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) @@ -76,12 +74,12 @@ describe('Edit basicData path', () => { nightmare .wait(selectors.basicData.nameInput) .clearInput(selectors.basicData.nameInput) - .type(selectors.basicData.nameInput, 'Carol Danvers Edited') + .type(selectors.basicData.nameInput, 'Ororo Munroe') .click(selectors.basicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -96,67 +94,37 @@ describe('Edit basicData path', () => { .wait(selectors.basicData.nameInput) .getInputValue(selectors.basicData.nameInput) .then(result => { - expect(result).toEqual('Carol Danvers Edited'); + expect(result).toEqual('Ororo Munroe'); done(); }) .catch(catchErrors(done)); }); - it('should edit the tax number', done => { + it('should edit the contact name', done => { nightmare - .wait(selectors.basicData.taxNumberInput) - .clearInput(selectors.basicData.taxNumberInput) - .type(selectors.basicData.taxNumberInput, 'AVG tax Edited') + .wait(selectors.basicData.contactInput) + .clearInput(selectors.basicData.contactInput) + .type(selectors.basicData.contactInput, 'Black Panther') .click(selectors.basicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); }); - it('should confirm the tax number have been edited', done => { + it('should confirm the contact name have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) .wait(selectors.fiscalData.addressInput) .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.taxNumberInput) - .getInputValue(selectors.basicData.taxNumberInput) + .wait(selectors.basicData.contactInput) + .getInputValue(selectors.basicData.contactInput) .then(result => { - expect(result).toEqual('AVG tax Edited'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should edit the social name', done => { - nightmare - .wait(selectors.basicData.socialNameInput) - .clearInput(selectors.basicData.socialNameInput) - .type(selectors.basicData.socialNameInput, 'Avengers Team Edited') - .click(selectors.basicData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual('¡Datos guardados!'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should confirm the social name have been edited', done => { - nightmare - .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.socialNameInput) - .getInputValue(selectors.basicData.socialNameInput) - .then(result => { - expect(result).toEqual('Avengers Team Edited'); + expect(result).toEqual('Black Panther'); done(); }) .catch(catchErrors(done)); @@ -171,7 +139,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -201,7 +169,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -222,46 +190,16 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it('should add the fax number', done => { - nightmare - .wait(selectors.basicData.faxInput) - .clearInput(selectors.basicData.faxInput) - .type(selectors.basicData.faxInput, '432198765') - .click(selectors.basicData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual('¡Datos guardados!'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should confirm the fax number have been added', done => { - nightmare - .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.faxInput) - .getInputValue(selectors.basicData.faxInput) - .then(result => { - expect(result).toEqual('432198765'); - done(); - }) - .catch(catchErrors(done)); - }); - it('should edit the email', done => { nightmare .wait(selectors.basicData.emailInput) .clearInput(selectors.basicData.emailInput) - .type(selectors.basicData.emailInput, 'CarolDanversEdited@verdnatura.es') + .type(selectors.basicData.emailInput, 'Storm@verdnatura.es') .click(selectors.basicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -276,35 +214,52 @@ describe('Edit basicData path', () => { .wait(selectors.basicData.emailInput) .getInputValue(selectors.basicData.emailInput) .then(result => { - expect(result).toEqual('CarolDanversEdited@verdnatura.es'); + expect(result).toEqual('Storm@verdnatura.es'); done(); }) .catch(catchErrors(done)); }); - // it('should select the sales person', done => { - // nightmare - // .wait(selectors.basicData.salesPersonInput) - // .select(selectors.basicData.salesPersonInput, '') // not working quite yet - // .click(selectors.basicData.saveButton) - // .wait(selectors.globalItems.snackbarIsActive) - // .getInnerText(selectors.globalItems.snackbarIsActive) - // .then(result => { - // expect(result).toEqual('¡Datos guardados!'); - // done(); - // }) - // .catch(catchErrors(done)); - // }); + it('should select the sales person', done => { + nightmare + .waitToClick(selectors.basicData.salesPersonInput) + .waitToClick(selectors.basicData.salesBruceBannerOption) + .wait(200) + .waitToClick(selectors.basicData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the sales person have been selected', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.addressInput) + .waitToClick(selectors.basicData.basicDataButton) + .wait(200) + .getInputValue(selectors.basicData.salesPersonInput) + .then(result => { + expect(result).toEqual('Bruce Banner'); + done(); + }) + .catch(catchErrors(done)); + }); it('should select the channel', done => { nightmare .waitToClick(selectors.basicData.channelInput) .waitToClick(selectors.basicData.channelMetropolisOption) + .wait(400) .waitToClick(selectors.basicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); @@ -313,10 +268,10 @@ describe('Edit basicData path', () => { it('should confirm the channel have been selected', done => { nightmare .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) + .waitToClick(selectors.fiscalData.fiscalDataButton) .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.basicDataButton) + .waitToClick(selectors.basicData.basicDataButton) + .wait(400) .getInputValue(selectors.basicData.channelInput) .then(result => { expect(result).toEqual('Metropolis newspaper'); diff --git a/e2e/paths/03_edit_fiscal_data.spec.js b/e2e/paths/03_edit_fiscal_data.spec.js new file mode 100644 index 000000000..495f3c42a --- /dev/null +++ b/e2e/paths/03_edit_fiscal_data.spec.js @@ -0,0 +1,566 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Edit fiscalData path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Bruce Banner', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + describe('Confirm all addresses have EQtax false for future propagation test', () => { + it(`should click on the search result to access to the client's addresses`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.addresses.addressesButton) + .waitForURL('/addresses/list') + .url() + .then(url => { + expect(url).toContain('/addresses/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the 1st edit icon to check EQtax is checked`, done => { + nightmare + .waitToClick(selectors.addresses.firstEditButton) + .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should go back to addresses then select the second one and confirm the EQtax is checked`, done => { + nightmare + .waitToClick(selectors.addresses.addressesButton) + .waitToClick(selectors.addresses.secondEditButton) + .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + }); + + it(`should click on the fiscal data button to start editing`, done => { + nightmare + .waitToClick(selectors.fiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .url() + .then(url => { + expect(url).toContain('fiscal-data'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should edit the social name', done => { + nightmare + .wait(selectors.fiscalData.socialNameInput) + .clearInput(selectors.fiscalData.socialNameInput) + .type(selectors.fiscalData.socialNameInput, 'Hulk edited') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the social name have been edited', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.socialNameInput) + .getInputValue(selectors.fiscalData.socialNameInput) + .then(result => { + expect(result).toEqual('Hulk edited'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should edit the fiscal id', done => { + nightmare + .wait(selectors.fiscalData.fiscalIdInput) + .clearInput(selectors.fiscalData.fiscalIdInput) + .type(selectors.fiscalData.fiscalIdInput, '94980061C') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the fiscal id have been edited', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.fiscalIdInput) + .getInputValue(selectors.fiscalData.fiscalIdInput) + .then(result => { + expect(result).toEqual('94980061C'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should check the Equalization tax checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.equalizationTaxCheckboxLabel) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should propagate the Equalization tax', done => { + nightmare + .waitToClick(selectors.fiscalData.acceptPropagationButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Equalization tax checkbox is checked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.equalizationTaxCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + done(); + }) + .catch(catchErrors(done)); + }); + + describe('Confirm all addresses have now EQtax checked', () => { + it(`should click on the addresses button to access to the client's addresses`, done => { + nightmare + .waitToClick(selectors.addresses.addressesButton) + .waitForURL('/addresses/list') + .url() + .then(url => { + expect(url).toContain('/addresses/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the 1st edit icon to confirm EQtax is checked`, done => { + nightmare + .waitToClick(selectors.addresses.firstEditButton) + .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should go back to addresses then select the second one and confirm the EQtax is checked`, done => { + nightmare + .waitToClick(selectors.addresses.addressesButton) + .waitToClick(selectors.addresses.secondEditButton) + .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + done(); + }) + .catch(catchErrors(done)); + }); + }); + + it('should go to fiscal data then edit the address', done => { + nightmare + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.addressInput) + .clearInput(selectors.fiscalData.addressInput) + .type(selectors.fiscalData.addressInput, 'Somewhere edited') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the address have been edited', done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.addressInput) + .getInputValue(selectors.fiscalData.addressInput) + .then(result => { + expect(result).toEqual('Somewhere edited'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should edit the city', done => { + nightmare + .wait(selectors.fiscalData.cityInput) + .clearInput(selectors.fiscalData.cityInput) + .type(selectors.fiscalData.cityInput, 'N/A') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the city have been edited', done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.cityInput) + .getInputValue(selectors.fiscalData.cityInput) + .then(result => { + expect(result).toEqual('N/A'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should edit the postcode', done => { + nightmare + .wait(selectors.fiscalData.postcodeInput) + .clearInput(selectors.fiscalData.postcodeInput) + .type(selectors.fiscalData.postcodeInput, '12345') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the postcode have been edited', done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.postcodeInput) + .getInputValue(selectors.fiscalData.postcodeInput) + .then(result => { + expect(result).toEqual('12345'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should edit the province`, done => { + nightmare + .waitToClick(selectors.fiscalData.provinceInput) + .waitToClick(selectors.fiscalData.provinceFifthOption) + .wait(200) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should confirm the province have been selected`, done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.fiscalData.fiscalDataButton) + .wait(200) + .getInputValue(selectors.fiscalData.provinceInput) + .then(result => { + expect(result).toEqual('Province two'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should uncheck the active checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.activeCheckboxLabel) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm active checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.activeCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.activeCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should uncheck the invoice by address checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.invoiceByAddressCheckboxInput) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm invoice by address checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.invoiceByAddressCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.invoiceByAddressCheckboxInput) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should check the Verified data checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Verified data checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.verifiedDataCheckboxInput) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should uncheck the Has to invoice checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.hasToInvoiceCheckboxLabel) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Has to invoice checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.hasToInvoiceCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.hasToInvoiceCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should uncheck the Invoice by mail checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Invoice by mail checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.invoiceByMailCheckboxLabel) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.invoiceByMailCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should check the Vies checkbox', done => { + nightmare + .waitToClick(selectors.fiscalData.viesCheckboxInput) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Vies checkbox is checked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.viesCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.fiscalData.viesCheckboxInput) + .then(value => { + expect(value).toBeTruthy(); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/04_edit_pay_method.spec.js similarity index 53% rename from e2e/paths/edit_fiscal_data.spec.js rename to e2e/paths/04_edit_pay_method.spec.js index b7cefa28c..2ea65e936 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/04_edit_pay_method.spec.js @@ -5,20 +5,9 @@ import {catchErrors} from '../../services/utils/jasmineHelpers'; const nightmare = createNightmare(); const moduleAccessViewHashURL = '#!/'; -describe('Edit fiscalData path', () => { - describe('warm up', () => { - it('should warm up login and fixtures', done => { - nightmare - .login() - .waitForURL(moduleAccessViewHashURL) - .waitToClick(selectors.globalItems.logOutButton) - .then(() => { - done(); - }) - .catch(catchErrors(done)); - }); - }); +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; +describe('Edit pay method path', () => { it('should log in', done => { nightmare .login() @@ -31,6 +20,15 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + it('should click on the Clients button of the top bar menu', done => { nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) @@ -59,43 +57,150 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should click on the search result to access to the client's fiscal data`, done => { + it(`should click on the search result to access to the client's pay method`, done => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .waitForURL('fiscal-data') + .waitToClick(selectors.payMethod.payMethodButton) + .waitForURL('billing-data') .url() .then(url => { - expect(url).toContain('fiscal-data'); + expect(url).toContain('billing-data'); done(); }) .catch(catchErrors(done)); }); - it('should uncheck the hasToInvoice checkbox', done => { + it(`should edit the Pay method to any without IBAN`, done => { nightmare - .waitToClick(selectors.fiscalData.hasToInvoiceCheckboxLabel) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.payMethod.payMethodInput) + .waitToClick(selectors.payMethod.payMethodOptionOne) + .wait(200) + .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.payMethod.cancelNotificationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); }); - it('should confirm hasToInvoice checkbox is unchecked', done => { + it(`should confirm the Pay method have been selected`, done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.payMethod.payMethodButton) + .wait(200) + .getInputValue(selectors.payMethod.payMethodInput) + .then(result => { + expect(result).toEqual('PayMethod one'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error when changing payMethod to IBAN without an IBAN entered`, done => { + nightmare + .waitToClick(selectors.payMethod.payMethodInput) + .waitToClick(selectors.payMethod.payMethodIBANOption) + .wait(200) + .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.payMethod.cancelNotificationButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Error'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should add the IBAN`, done => { + nightmare + .clearInput(selectors.payMethod.IBANInput) + .type(selectors.payMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') + .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.payMethod.cancelNotificationButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should confirm the IBAN pay method is sucessfully saved`, done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.payMethod.payMethodButton) + .wait(200) + .getInputValue(selectors.payMethod.payMethodInput) + .then(result => { + expect(result).toEqual('PayMethod with IBAN'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should edit the due day`, done => { + nightmare + .clearInput(selectors.payMethod.dueDayInput) + .type(selectors.payMethod.dueDayInput, '60') + .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.payMethod.cancelNotificationButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the due day have been edited', done => { nightmare .waitForSnackbarReset() .waitToClick(selectors.basicData.basicDataButton) .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.hasToInvoiceCheckboxLabel) + .waitToClick(selectors.payMethod.payMethodButton) + .wait(selectors.payMethod.dueDayInput) + .getInputValue(selectors.payMethod.dueDayInput) + .then(result => { + expect(result).toEqual('60'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should uncheck the Received core VNH checkbox', done => { + nightmare + .waitToClick(selectors.payMethod.receivedCoreVNHCheckbox) + .waitToClick(selectors.payMethod.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Received core VNH checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.payMethod.payMethodButton) + .wait(selectors.payMethod.receivedCoreVNHCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.hasToInvoiceCheckboxLabel) + }, selectors.payMethod.receivedCoreVNHCheckbox) .then(value => { expect(value).toBeFalsy(); done(); @@ -103,29 +208,29 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it('should uncheck the invoiceByMail checkbox', done => { + it('should uncheck the Received core VNL checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.payMethod.receivedCoreVNLCheckbox) + .waitToClick(selectors.payMethod.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); }); - it('should confirm invoiceByMail checkbox is unchecked', done => { + it('should confirm Received core VNL checkbox is unchecked', done => { nightmare .waitForSnackbarReset() .waitToClick(selectors.basicData.basicDataButton) .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.invoiceByMailCheckboxLabel) + .waitToClick(selectors.payMethod.payMethodButton) + .wait(selectors.payMethod.receivedCoreVNLCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.invoiceByMailCheckboxLabel) + }, selectors.payMethod.receivedCoreVNLCheckbox) .then(value => { expect(value).toBeFalsy(); done(); @@ -133,149 +238,31 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it('should edit the address', done => { + it('should uncheck the Received B2B VNL checkbox', done => { nightmare - .wait(selectors.fiscalData.addressInput) - .clearInput(selectors.fiscalData.addressInput) - .type(selectors.fiscalData.addressInput, 'Alpha Flight Low-Orbit') - .click(selectors.fiscalData.saveButton) + .waitToClick(selectors.payMethod.receivedB2BVNLCheckbox) + .waitToClick(selectors.payMethod.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('Data saved!'); done(); }) .catch(catchErrors(done)); }); - it('should confirm the address have been edited', done => { + it('should confirm Received B2B VNL checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) + .waitToClick(selectors.basicData.basicDataButton) .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .getInputValue(selectors.fiscalData.addressInput) - .then(result => { - expect(result).toEqual('Alpha Flight Low-Orbit'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should edit the city', done => { - nightmare - .wait(selectors.fiscalData.cityInput) - .clearInput(selectors.fiscalData.cityInput) - .type(selectors.fiscalData.cityInput, 'N/A') - .click(selectors.fiscalData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual('¡Datos guardados!'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should confirm the city have been edited', done => { - nightmare - .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.cityInput) - .getInputValue(selectors.fiscalData.cityInput) - .then(result => { - expect(result).toEqual('N/A'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should edit the postcode', done => { - nightmare - .wait(selectors.fiscalData.postcodeInput) - .clearInput(selectors.fiscalData.postcodeInput) - .type(selectors.fiscalData.postcodeInput, '12345') - .click(selectors.fiscalData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual('¡Datos guardados!'); - done(); - }) - .catch(catchErrors(done)); - }); - - it('should confirm the postcode have been edited', done => { - nightmare - .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.postcodeInput) - .getInputValue(selectors.fiscalData.postcodeInput) - .then(result => { - expect(result).toEqual('12345'); - done(); - }) - .catch(catchErrors(done)); - }); - - it(`should edit the province`, done => { - nightmare - .waitToClick(selectors.fiscalData.provinceInput) - .waitToClick(selectors.fiscalData.provinceFifthOption) - .waitToClick(selectors.fiscalData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual(`¡Datos guardados!`); - done(); - }) - .catch(catchErrors(done)); - }); - - it(`should confirm the province have been selected`, done => { - nightmare - .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(100) - .getInputValue(selectors.fiscalData.provinceInput) - .then(result => { - expect(result).toEqual('Province two'); - done(); - }) - .catch(catchErrors(done)); - }); - - it(`should edit the country`, done => { - nightmare - .waitToClick(selectors.fiscalData.countryInput) - .waitToClick(selectors.fiscalData.countryThirdOption) - .waitToClick(selectors.fiscalData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual(`¡Datos guardados!`); - done(); - }) - .catch(catchErrors(done)); - }); - - it(`should confirm the country have been selected`, done => { - nightmare - .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.fiscalData.basicDataButton) - .wait(100) - .getInputValue(selectors.fiscalData.countryInput) - .then(result => { - expect(result).toEqual('Holanda'); + .waitToClick(selectors.payMethod.payMethodButton) + .wait(selectors.payMethod.receivedB2BVNLCheckbox) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.payMethod.receivedB2BVNLCheckbox) + .then(value => { + expect(value).toBeFalsy(); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/05_edit_addresses.spec.js b/e2e/paths/05_edit_addresses.spec.js new file mode 100644 index 000000000..eebd709a5 --- /dev/null +++ b/e2e/paths/05_edit_addresses.spec.js @@ -0,0 +1,288 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Edit addresses path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Bruce Banner', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client's pay method`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.addresses.addressesButton) + .waitForURL('addresses/list') + .url() + .then(url => { + expect(url).toContain('addresses/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the add new address button to access to the new address form`, done => { + nightmare + .waitToClick(selectors.addresses.createAddress) + .waitForURL('addresses/create') + .url() + .then(url => { + expect(url).toContain('addresses/create'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should check the default checkbox then receive an error after clicking save button as the form is empty', done => { + nightmare + .waitToClick(selectors.addresses.defaultCheckboxInput) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but consignee', done => { + nightmare + .waitForSnackbarReset() + .type(selectors.addresses.consigneeInput, 'Bruce Bunner') + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but Street', done => { + nightmare + .waitForSnackbarReset() + .clearInput(selectors.addresses.consigneeInput) + .type(selectors.addresses.streetAddressInput, '320 Park Avenue New York') + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but postcode', done => { + nightmare + .waitForSnackbarReset() + .clearInput(selectors.addresses.streetAddressInput) + .type(selectors.addresses.postcodeInput, '10022') + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but city', done => { + nightmare + .waitForSnackbarReset() + .clearInput(selectors.addresses.postcodeInput) + .type(selectors.addresses.cityInput, 'New York') + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but province', done => { + nightmare + .waitForSnackbarReset() + .clearInput(selectors.addresses.cityInput) + .waitToClick(selectors.addresses.provinceInput) + .waitToClick(selectors.addresses.provinceSecondOption) + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but province and agency', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.addresses.agencyInput) + .waitToClick(selectors.addresses.agenctySecondOption) + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but province, agency and phone', done => { + nightmare + .waitForSnackbarReset() + .type(selectors.addresses.phoneInput, '999887744') + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should receive an error when clicking the save button having all the form fields empty but province, agency and mobile', done => { + nightmare + .waitForSnackbarReset() + .clearInput(selectors.addresses.phoneInput) + .type(selectors.addresses.mobileInput, '999887744') + .click(selectors.createClientView.createButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should create a new address with all it's data`, done => { + nightmare + .waitForSnackbarReset() + .type(selectors.addresses.consigneeInput, 'Bruce Bunner') + .type(selectors.addresses.streetAddressInput, '320 Park Avenue New York') + .type(selectors.addresses.postcodeInput, '10022') + .type(selectors.addresses.cityInput, 'New York') + .type(selectors.addresses.phoneInput, '999887744') + .click(selectors.addresses.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the addresses button confirm the new address exists and it's the default one`, done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.addresses.addressesButton) + .wait(selectors.addresses.defaultAddress) + .getInnerText(selectors.addresses.defaultAddress) + .then(result => { + expect(result).toContain('320 Park Avenue New York'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the make default icon of the second address then confirm it is the default one now`, done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.addresses.secondMakeDefaultStar) + .waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand') + .getInnerText(selectors.addresses.defaultAddress) + .then(result => { + expect(result).toContain('Somewhere in Thailand'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the edit icon of the default address`, done => { + nightmare + .waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand') + .waitToClick(selectors.addresses.firstEditButton) + .waitForURL('/edit') + .url() + .then(result => { + expect(result).toContain('/edit'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the active checkbox and receive an error to save it becouse it is the default address`, done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.addresses.activeCheckbox) + .waitToClick(selectors.addresses.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Error'); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/06_edit_web_access.spec.js b/e2e/paths/06_edit_web_access.spec.js new file mode 100644 index 000000000..6bb20d593 --- /dev/null +++ b/e2e/paths/06_edit_web_access.spec.js @@ -0,0 +1,133 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Edit web access path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Bruce Banner', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client's web access`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.webAccess.webAccessButton) + .waitForURL('web-access') + .url() + .then(url => { + expect(url).toContain('web-access'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the Enable web access checkbox to uncheck it`, done => { + nightmare + .waitToClick(selectors.webAccess.enableWebAccessCheckbox) + .waitToClick(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain(`Data saved!`); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm Enable web access checkbox is unchecked', done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.webAccess.webAccessButton) + .wait(selectors.webAccess.enableWebAccessCheckbox) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.webAccess.enableWebAccessCheckbox) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should edit the User name', done => { + nightmare + .wait(selectors.webAccess.userNameInput) + .clearInput(selectors.webAccess.userNameInput) + .type(selectors.webAccess.userNameInput, 'Hulk') + .click(selectors.webAccess.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the User name have been edited', done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.webAccess.webAccessButton) + .wait(selectors.webAccess.userNameInput) + .getInputValue(selectors.webAccess.userNameInput) + .then(result => { + expect(result).toEqual('Hulk'); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/07_add_notes.spec.js b/e2e/paths/07_add_notes.spec.js new file mode 100644 index 000000000..339ea186e --- /dev/null +++ b/e2e/paths/07_add_notes.spec.js @@ -0,0 +1,110 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Add notes path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Bruce Banner', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client's notes`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.notes.notesButton) + .waitForURL('notes/list') + .url() + .then(url => { + expect(url).toContain('notes/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the add note button`, done => { + nightmare + .waitToClick(selectors.notes.addNoteFloatButton) + .waitForURL('/notes/create') + .url() + .then(url => { + expect(url).toContain('/notes/create'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should create a note`, done => { + nightmare + .type(selectors.notes.noteInput, 'Meeting with Black Widow 21th 9am') + .click(selectors.notes.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the note was created', done => { + nightmare + .waitForSnackbarReset() + .wait(selectors.notes.firstNoteText) + .getInnerText(selectors.notes.firstNoteText) + .then(value => { + expect(value).toEqual('Meeting with Black Widow 21th 9am'); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/08_add_credit.spec.js b/e2e/paths/08_add_credit.spec.js new file mode 100644 index 000000000..a106bfd27 --- /dev/null +++ b/e2e/paths/08_add_credit.spec.js @@ -0,0 +1,111 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Add credit path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Petter Parker', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client's credit`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.credit.creditButton) + .waitForURL('credit/list') + .url() + .then(url => { + expect(url).toContain('credit/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the add credit button`, done => { + nightmare + .waitToClick(selectors.credit.addCreditFloatButton) + .waitForURL('/credit/create') + .url() + .then(url => { + expect(url).toContain('/credit/create'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should edit the credit`, done => { + nightmare + .clearInput(selectors.credit.creditInput) + .type(selectors.credit.creditInput, 999) + .click(selectors.credit.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the credit was updated', done => { + nightmare + .waitForSnackbarReset() + .wait(selectors.credit.firstCreditText) + .getInnerText(selectors.credit.firstCreditText) + .then(value => { + expect(value).toContain(999); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/09_add_greuge.spec.js b/e2e/paths/09_add_greuge.spec.js new file mode 100644 index 000000000..594193321 --- /dev/null +++ b/e2e/paths/09_add_greuge.spec.js @@ -0,0 +1,168 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Add greuge path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Petter Parker', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client's greuge`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.greuge.greugeButton) + .waitForURL('greuge/list') + .url() + .then(url => { + expect(url).toContain('greuge/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the add greuge button`, done => { + nightmare + .waitToClick(selectors.greuge.addGreugeFloatButton) + .waitForURL('greuge/create') + .url() + .then(url => { + expect(url).toContain('greuge/create'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error if all fields are empty but date on submit`, done => { + nightmare + .click(selectors.credit.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error if all fields are empty but date and amount on submit`, done => { + nightmare + .type(selectors.greuge.amountInput, 999) + .click(selectors.greuge.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error if all fields are empty but date and description on submit`, done => { + nightmare + .clearInput(selectors.greuge.amountInput) + .type(selectors.greuge.descriptionInput, 'new armor for Batman!') + .click(selectors.greuge.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error if all fields are empty but date and type on submit`, done => { + nightmare + .clearInput(selectors.greuge.descriptionInput) + .waitToClick(selectors.greuge.typeInput) + .waitToClick(selectors.greuge.typeSecondOption) + .click(selectors.greuge.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Some fields are invalid'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should create a new greuge with all its data`, done => { + nightmare + .clearInput(selectors.greuge.amountInput) + .type(selectors.greuge.amountInput, 999) + .type(selectors.greuge.descriptionInput, 'new armor for Batman!') + .click(selectors.greuge.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Data saved!'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the greuge was added to the list', done => { + nightmare + .waitForSnackbarReset() + .wait(selectors.greuge.firstGreugeText) + .getInnerText(selectors.greuge.firstGreugeText) + .then(value => { + expect(value).toContain(999); + expect(value).toContain('new armor for Batman!'); + expect(value).toContain('Diff'); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/10_mandate.spec.js b/e2e/paths/10_mandate.spec.js new file mode 100644 index 000000000..02a1f9b86 --- /dev/null +++ b/e2e/paths/10_mandate.spec.js @@ -0,0 +1,86 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('mandate path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Petter Parker', done => { + nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client's mandate`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.mandate.mandateButton) + .waitForURL('mandate') + .url() + .then(url => { + expect(url).toContain('mandate'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should confirm the client has a mandate of the CORE type', done => { + nightmare + .wait(selectors.mandate.firstMandateText) + .getInnerText(selectors.mandate.firstMandateText) + .then(value => { + expect(value).toContain('1'); + expect(value).toContain('WAY'); + expect(value).toContain('CORE'); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e_tests.js b/e2e_tests.js index 4fecbaff0..dd1d7a079 100644 --- a/e2e_tests.js +++ b/e2e_tests.js @@ -18,11 +18,11 @@ var SpecReporter = require('jasmine-spec-reporter').SpecReporter; jasmine.loadConfig({ spec_files: [ - './e2e/helpers/extensions.js', - './e2e/**/*[sS]pec.js' + './e2e/**/*[sS]pec.js', + './e2e/helpers/extensions.js' ], helpers: [ - // '/services/utils/jasmineHelpers.js' + '/services/utils/jasmineHelpers.js' ] }); diff --git a/gulpfile.js b/gulpfile.js index 069ff5a89..327a51579 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,67 +1,98 @@ -var gulp = require('gulp'); -var gutil = require('gulp-util'); -var wrap = require('gulp-wrap'); -var concat = require('gulp-concat'); -var merge = require('merge-stream'); -var extend = require('gulp-extend'); -var install = require('gulp-install'); -var print = require('gulp-print'); -var runSequence = require('run-sequence'); -var del = require('del'); -var fs = require('fs'); -var webpack = require('webpack'); -var WebpackDevServer = require('webpack-dev-server'); - -var exec = require('child_process').exec; +require('require-yaml'); +const gulp = require('gulp'); +const gutil = require('gulp-util'); +const wrap = require('gulp-wrap'); +const concat = require('gulp-concat'); +const merge = require('merge-stream'); +const print = require('gulp-print'); +const runSequence = require('run-sequence'); +const fs = require('fs-extra'); +const webpack = require('webpack'); +const WebpackDevServer = require('webpack-dev-server'); +const exec = require('child_process').exec; +const path = require('path'); // Configuration -var srcDir = './client'; -var buildDir = './services/nginx/static'; -var langs = ['es', 'en']; -var modules = require('./client/modules.json'); +const isWindows = /^win/.test(process.platform); +const env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; -var webpackConfig = require('./webpack.config.js'); +const langs = ['es', 'en']; +const srcDir = './client'; +const servicesDir = './services'; +const nginxDir = `${servicesDir}/nginx`; +const buildDir = `${nginxDir}/static`; -// Main tasks +const modules = require('./client/modules.yml'); +const webpackConfig = require('./webpack.config.js'); -gulp.task('default', function() { +let proxyConf = require(`${nginxDir}/config.yml`); +let proxyEnvFile = `${nginxDir}/config.${env}.yml`; + +if (fs.existsSync(proxyEnvFile)) + Object.assign(proxyConf, require(proxyEnvFile)); + +const defaultService = proxyConf.main; +const defaultPort = proxyConf.defaultPort; +const devServerPort = proxyConf.devServerPort; + +// Development + +gulp.task('default', () => { return gulp.start('services', 'client'); }); -gulp.task('build', ['clean'], function() { - return gulp.start('routes', 'locales', 'webpack'); -}); - -gulp.task('client', ['clean'], function() { +gulp.task('client', ['clean'], () => { return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server'); }); -gulp.task('services', () => { - process.env.NODE_ENV = gutil.env.env || 'development'; - const pathServices = './services/'; - const services = fs.readdirSync(pathServices); - services.splice(services.indexOf('loopback'), 1); - return services.forEach(service => { - const serviceJs = pathServices.concat(service, '/server/server.js'); - if (fs.existsSync(serviceJs)) - require(serviceJs).start(); +gulp.task('services', callback => { + let command = isWindows + ? 'docker inspect dblocal | findstr Status' + : 'docker inspect dblocal | grep Status'; + + exec(command, (err, stdout, stderr) => { + if (err) return callback(err); + let isNotRunning = !stdout.includes('running'); + if (isNotRunning) + runSequence('docker-wait', 'services-run', callback); + else + runSequence('services-run', callback); }); }); -gulp.task('clean', function() { +gulp.task('services-run', async () => { + const services = await getServices(); + for (let service of services) + require(service.index).start(service.port); + + return gulp.start('nginx'); +}); + +gulp.task('e2e', ['docker-wait'], () => { + return gulp.start('e2e-run'); +}); + +gulp.task('e2e-run', () => { + const jasmine = require('gulp-jasmine'); + gulp.src('./e2e_tests.js') + .pipe(jasmine({reporter: 'none'})); +}); + +gulp.task('clean', () => { + const del = require('del'); return del([`${buildDir}/*`, `!${buildDir}/templates`, `!${buildDir}/images`], {force: true}); }); gulp.task('install', () => { - const pathServices = './services/'; - const fileJson = []; - const services = fs.readdirSync(pathServices); + const install = require('gulp-install'); + let jsonFile = []; + let services = fs.readdirSync(servicesDir); services.push('..'); services.forEach(service => { - fileJson.push(pathServices.concat(service, '/package.json')); + jsonFile.push(`${servicesDir}/${service}/package.json`); }); - return gulp.src(fileJson) + return gulp.src(jsonFile) .pipe(print(filepath => { return `Installing packages in ${filepath}`; })) @@ -70,11 +101,152 @@ gulp.task('install', () => { })); }); +// Gulp install alias +gulp.task('i', ['install']); + +// Deployment + +gulp.task('build', ['clean'], () => { + return gulp.start('routes', 'locales', 'webpack', 'docker-compose', 'nginx-conf'); +}); + +gulp.task('docker-compose', async () => { + let compose = await fs.readFile('./docker-compose.tpl.yml', 'utf8'); + + const yaml = require('js-yaml'); + let composeYml = yaml.safeLoad(compose); + let services = await getServices(); + + for (let service of services) { + let dockerFile = `${__dirname}/Dockerfile`; + + if (await fs.exists(`./services/${service.name}/Dockerfile`)) + dockerFile = 'Dockerfile'; + + composeYml.services[service.name] = { + environment: ['NODE_ENV=${NODE_ENV}'], + container_name: `\${BRANCH_NAME}-${service.name}`, + image: `${service.name}:\${TAG}`, + build: { + context: `./services/${service.name}`, + dockerfile: dockerFile + }, + ports: [`${defaultPort}:${service.port}`] + }; + composeYml.services.nginx.links.push( + `${service.name}:\${BRANCH_NAME}-${service.name}` + ); + } + + let ymlString = yaml.safeDump(composeYml); + await fs.writeFile('./docker-compose.yml', ymlString); +}); + +// Nginx & services + +let nginxConf = 'temp/nginx.conf'; +let nginxTemp = `${nginxDir}/temp`; + +async function nginxGetBin() { + if (isWindows) + return 'nginx'; + try { + let nginxBin = '/usr/sbin/nginx'; + await fs.stat(nginxBin); + return nginxBin; + } catch (e) { + return 'nginx'; + } +} + +gulp.task('nginx', ['nginx-stop'], async () => { + let nginxBin = await nginxGetBin(); + + if (isWindows) + nginxBin = `start /B ${nginxBin}`; + + return new Promise((resolve, reject) => { + exec(`${nginxBin} -c "${nginxConf}" -p "${nginxDir}"`, err => { + if (err) return reject(err); + resolve(); + }); + }); +}); + +gulp.task('nginx-stop', ['nginx-conf'], async () => { + try { + let nginxBin = await nginxGetBin(); + await fs.stat(`${nginxTemp}/nginx.pid`); + let command = `${nginxBin} -c "${nginxConf}" -p "${nginxDir}" -s stop`; + + return new Promise((resolve, reject) => { + exec(command, err => { + if (err) return reject(err); + resolve(); + }); + }); + } catch (e) {} +}); + +gulp.task('nginx-conf', async () => { + const mustache = require('mustache'); + + let params = { + services: await getServices(), + defaultService: defaultService, + defaultPort: defaultPort, + devServerPort: devServerPort, + port: proxyConf.port, + host: proxyConf.host + }; + + let confFile = `${nginxDir}/nginx.${env}.mst`; + + if (!await fs.exists(confFile)) + confFile = `${nginxDir}/nginx.mst`; + + let template = await fs.readFile(confFile, 'utf8'); + let nginxConf = mustache.render(template, params); + + await fs.writeFile(`${nginxDir}/temp/nginx.conf`, nginxConf); +}); + +gulp.task('nginx-clean', () => { + const del = require('del'); + return del([`${nginxDir}/temp/*`], {force: true}); +}); + +let services; + +async function getServices() { + if (services) return services; + + let startPort = defaultPort + 1; + services = []; + + const serviceDirs = await fs.readdir(servicesDir); + const exclude = ['loopback']; + + for (let service of serviceDirs) { + let index = `${servicesDir}/${service}/server/server.js`; + if (!await fs.exists(index) || exclude.indexOf(service) !== -1) continue; + + let port = service == defaultService ? defaultPort : startPort++; + services.push({ + name: service, + index: index, + port: port + }); + } + + return services; +} + // Webpack gulp.task('webpack', function(cb) { - var configCopy = Object.create(webpackConfig); - var compiler = webpack(configCopy); + let configCopy = Object.create(webpackConfig); + let compiler = webpack(configCopy); compiler.run(function(err, stats) { if (err) throw new gutil.PluginError('webpack', err); @@ -84,14 +256,14 @@ gulp.task('webpack', function(cb) { }); gulp.task('webpack-dev-server', function() { - var configCopy = Object.create(webpackConfig); + let configCopy = Object.create(webpackConfig); - for (var entry in configCopy.entry) { + for (let entry in configCopy.entry) { configCopy.entry[entry] - .unshift('webpack-dev-server/client?http://127.0.0.1:8081/'); + .unshift(`webpack-dev-server/client?http://127.0.0.1:${devServerPort}/`); } - var compiler = webpack(configCopy); + let compiler = webpack(configCopy); new WebpackDevServer(compiler, { publicPath: '/', contentBase: buildDir, @@ -107,22 +279,25 @@ gulp.task('webpack-dev-server', function() { chunks: false, chunkModules: false } - }).listen(8081, '127.0.0.1', function(err) { + }).listen(devServerPort, '127.0.0.1', function(err) { if (err) throw new gutil.PluginError('webpack-dev-server', err); }); }); // Locale -var localeFiles = `${srcDir}/**/locale/*.json`; +let localeFiles = `${srcDir}/**/locale/*.json`; gulp.task('locales', function() { - var streams = []; + const extend = require('gulp-extend'); + const yaml = require('gulp-yaml'); + let streams = []; - for (var mod in modules) - for (var lang of langs) { - var localeFiles = `./client/${mod}/**/locale/${lang}.json`; + for (let mod in modules) + for (let lang of langs) { + let localeFiles = `./client/${mod}/**/locale/${lang}.yml`; streams.push(gulp.src(localeFiles) + .pipe(yaml()) .pipe(extend(`${lang}.json`)) .pipe(gulp.dest(`${buildDir}/locale/${mod}`))); } @@ -132,7 +307,7 @@ gulp.task('locales', function() { // Routes -var routeFiles = `${srcDir}/**/routes.json`; +let routeFiles = `${srcDir}/**/routes.json`; gulp.task('routes', function() { return gulp.src(routeFiles) @@ -142,43 +317,59 @@ gulp.task('routes', function() { }); // Watch + gulp.task('watch', function() { gulp.watch(routeFiles, ['routes']); gulp.watch(localeFiles, ['locales']); }); -// Test environment -gulp.task('test', callback => { - return require('./services_tests').start(); -}); +// Docker -// docker dblocal gulp.task('docker', callback => { - runSequence('deleteDockerDb', 'deleteDockerImageDb', 'buildDockerDb', 'runDockerDb', callback); + runSequence('docker-delete', 'docker-delete-image', 'docker-build', 'docker-run', callback); }); -gulp.task('runDockerDb', callback => { +gulp.task('docker-wait', ['docker'], callback => { + let maxInterval = 30 * 60000; + let interval = 1000; + let timer = 0; + console.log('Waiting for MySQL init process...'); + let waitForLocaldb = setInterval(() => { + if (timer < maxInterval) { + timer += interval; + exec('docker logs --tail 4 dblocal', (err, stdout, stderr) => { + if (stdout.includes('MySQL init process done. Ready for start up.')) { + clearInterval(waitForLocaldb); + callback(err); + } + }); + } else { + console.log(`MySQL connection not established whithin ${maxInterval / 1000} secs!`); + clearInterval(waitForLocaldb); + } + }, interval); +}); + +gulp.task('docker-run', callback => { exec('docker run -d --name dblocal -p 3306:3306 dblocal', (err, stdout, stderr) => { - setTimeout(() => { - callback(err); - }, 15000); + callback(err); }); }); -gulp.task('buildDockerDb', callback => { +gulp.task('docker-build', callback => { exec('docker build -t dblocal:latest ./services/db', (err, stdout, stderr) => { callback(err); }); }); -gulp.task('deleteDockerImageDb', callback => { +gulp.task('docker-delete-image', callback => { exec('docker rmi dblocal:latest', (err, stdout, stderr) => { - callback(err = null); + callback(err); }); }); -gulp.task('deleteDockerDb', callback => { +gulp.task('docker-delete', callback => { exec('docker stop dblocal && docker wait dblocal && docker rm -f dblocal', (err, stdout, stderr) => { - callback(err = null); + callback(err); }); }); diff --git a/karma.conf.js b/karma.conf.js index f25054d2d..216d51392 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -8,7 +8,7 @@ webpackConfig.plugins = []; // Generated on Tue Aug 22 2017 13:37:43 GMT+0200 (CEST) module.exports = function(config) { - config.set({ + let baseConfig = { // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', @@ -61,7 +61,7 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['Chrome', 'Firefox'], + browsers: [], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits @@ -78,5 +78,39 @@ module.exports = function(config) { 'karma-firefox-launcher', 'karma-sourcemap-loader' ] - }); + }; + + let browserConfig; + + if (process.env.FIREFOX_BIN) { + browserConfig = { + browsers: ['FirefoxHeadless'], + customLaunchers: { + FirefoxHeadless: { + base: 'Firefox', + flags: ['--headless'] + } + } + }; + } else { + browserConfig = { + browsers: ['ChromeNoSandboxHeadless'], + customLaunchers: { + ChromeNoSandboxHeadless: { + base: 'Chrome', + flags: [ + '--no-sandbox', + // See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md + '--headless', + '--disable-gpu', + // Without a remote debugging port, Google Chrome exits immediately. + ' --remote-debugging-port=9222' + ] + } + } + }; + } + + Object.assign(baseConfig, browserConfig); + config.set(baseConfig); }; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..e10725348 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,15360 @@ +{ + "name": "salix-app", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "7.0.48", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.48.tgz", + "integrity": "sha1-JL/cCqguj229AXFZxYCUouBtCrs=", + "dev": true + }, + "@uirouter/angularjs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.3.tgz", + "integrity": "sha1-UYuHVUK02G3RqvX0JizO5BbywWY=", + "requires": { + "@uirouter/core": "5.0.3" + } + }, + "@uirouter/core": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@uirouter/core/-/core-5.0.3.tgz", + "integrity": "sha1-4rWx5FGQ4gxnuk4VwBPeXU4MyrM=" + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true + }, + "accepts": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", + "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", + "dev": true, + "requires": { + "mime-types": "2.1.12", + "negotiator": "0.6.1" + } + }, + "acorn": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.8.tgz", + "integrity": "sha1-9B5SAgzngRijxo7Q6SFeuPxotbE=", + "dev": true + }, + "acorn-dynamic-import": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-2.0.1.tgz", + "integrity": "sha1-I/Zx625lDasnf+9HfDIbEXiozKI=", + "dev": true, + "requires": { + "acorn": "4.0.8" + } + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "dev": true + }, + "ajv": { + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.2.tgz", + "integrity": "sha1-8WbDwRy8bLncwQKlvP5bcslSh+Y=", + "dev": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.0.4", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "angular": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/angular/-/angular-1.6.8.tgz", + "integrity": "sha1-W+N4pYvpGlSJ54tZxFGM2f0nP/s=" + }, + "angular-cookies": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/angular-cookies/-/angular-cookies-1.6.4.tgz", + "integrity": "sha1-wo8/aqx6mCbB5F8daAckADblsm0=" + }, + "angular-mocks": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.6.6.tgz", + "integrity": "sha1-yTAY54OMbcXOrxprz5vhPIMOpRU=", + "dev": true + }, + "angular-paging": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/angular-paging/-/angular-paging-2.2.2.tgz", + "integrity": "sha1-cC9XTW0UBpADXqxkOV/jEfeYf7s=" + }, + "angular-translate": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.17.0.tgz", + "integrity": "sha512-SudfI0R0Hhtvngc0X3wFChXQGmw90o95i+QPZ11LhJJryneTq8LR3+3E4E7jgHA4fu6TcswgcfZ9+cp5ckbUHw==", + "requires": { + "angular": "1.6.8" + } + }, + "angular-translate-loader-partial": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/angular-translate-loader-partial/-/angular-translate-loader-partial-2.17.0.tgz", + "integrity": "sha512-pyRJcRc93iwiUnRnh9ZfehbQE/yxO5T6jmEqIvLEVz8gKLjDqDLKcaQFgPef9wCIN2n3e531YbStkkbSH3LYmQ==", + "requires": { + "angular-translate": "2.17.0" + } + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, + "anymatch": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.0.tgz", + "integrity": "sha1-o+Uvo5FoyCX/V7AkgSbOWo/5VQc=", + "dev": true, + "requires": { + "arrify": "1.0.1", + "micromatch": "2.3.11" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "dev": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.1.5" + } + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "1.0.1" + } + }, + "arr-flatten": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz", + "integrity": "sha1-5f/lTUXhnzLyFukeuZyM6JK7YEs=", + "dev": true + }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arraybuffer.slice": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", + "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "asn1.js": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz", + "integrity": "sha1-SLokC0WpKA6UdImQull9IWYX/UA=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + } + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "ast-types": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.2.tgz", + "integrity": "sha1-LMGZedFcZVEIv1ZTI7jn7jh1H2s=", + "dev": true + }, + "async": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/async/-/async-2.1.2.tgz", + "integrity": "sha1-YSpKtF70KnDN6Aa62G7m2wR+g4U=", + "dev": true, + "requires": { + "lodash": "4.16.6" + } + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "async-foreach": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", + "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", + "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "aws4": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz", + "integrity": "sha1-Cin/t5wxyecS7rCH6OemS0pW11U=", + "dev": true + }, + "babel": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/babel/-/babel-6.5.2.tgz", + "integrity": "sha1-WRQGB0OCcJIAR/9W8CsthjDC0Sk=", + "dev": true + }, + "babel-code-frame": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", + "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.1" + } + }, + "babel-core": { + "version": "6.22.1", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.22.1.tgz", + "integrity": "sha1-nF/WWLoXctKNch9tJdlo/HriFkg=", + "dev": true, + "requires": { + "babel-code-frame": "6.22.0", + "babel-generator": "6.22.0", + "babel-helpers": "6.22.0", + "babel-messages": "6.22.0", + "babel-register": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0", + "babylon": "6.15.0", + "convert-source-map": "1.3.0", + "debug": "2.2.0", + "json5": "0.5.0", + "lodash": "4.16.6", + "minimatch": "3.0.3", + "path-is-absolute": "1.0.1", + "private": "0.1.6", + "slash": "1.0.0", + "source-map": "0.5.6" + } + }, + "babel-generator": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.22.0.tgz", + "integrity": "sha1-1kK/SWGRGorcfGkrDJKX8yXNqAU=", + "dev": true, + "requires": { + "babel-messages": "6.22.0", + "babel-runtime": "6.22.0", + "babel-types": "6.22.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.16.6", + "source-map": "0.5.6" + } + }, + "babel-helper-call-delegate": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.22.0.tgz", + "integrity": "sha1-EZkhtWEg8X6drj90tPXMe8wbN+8=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "6.22.0", + "babel-runtime": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0" + } + }, + "babel-helper-define-map": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.22.0.tgz", + "integrity": "sha1-lUTpUCstbf59AP9g6CvVp6ielbc=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.22.0", + "babel-runtime": "6.22.0", + "babel-types": "6.22.0", + "lodash": "4.16.6" + } + }, + "babel-helper-function-name": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.22.0.tgz", + "integrity": "sha1-UfG9xLuJsV9XqbJJ8z10KBbcvvw=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0" + } + }, + "babel-helper-get-function-arity": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.22.0.tgz", + "integrity": "sha1-C+tGStadxzR0EKxq3p8DpQY09c4=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-helper-hoist-variables": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.22.0.tgz", + "integrity": "sha1-Pqy/cx2AcFhF3S6XGPYAz7m0unI=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-helper-optimise-call-expression": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.22.0.tgz", + "integrity": "sha1-+NXUtApuJgWmp/nVN7WBvqN1bRU=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-helper-regex": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.22.0.tgz", + "integrity": "sha1-efUyvhZHsfDuNHS19cPaWAAdJH0=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0", + "lodash": "4.16.6" + } + }, + "babel-helper-replace-supers": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.22.0.tgz", + "integrity": "sha1-H87iJwZXVIkIw02xa8w0X5hQz0I=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "6.22.0", + "babel-messages": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0" + } + }, + "babel-helpers": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.22.0.tgz", + "integrity": "sha1-0nX1XyJSuBAb/we8DFVt7aZXOSw=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-template": "6.22.0" + } + }, + "babel-loader": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-6.4.1.tgz", + "integrity": "sha1-CzQRLVsHSKjc2/Uaz2+b1C1QuMo=", + "dev": true, + "requires": { + "find-cache-dir": "0.1.1", + "loader-utils": "0.2.16", + "mkdirp": "0.5.1", + "object-assign": "4.1.0" + } + }, + "babel-messages": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.22.0.tgz", + "integrity": "sha1-NgZqIU8SF+TtQWSGdmnss54+pXU=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.22.0.tgz", + "integrity": "sha1-ANbjoL69z+dTa51lO0SpFB5j5H4=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0", + "lodash": "4.16.6" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.22.0.tgz", + "integrity": "sha1-VNRJmP2CPZ3KFSkjJBYcMxwbbxQ=", + "dev": true, + "requires": { + "babel-helper-define-map": "6.22.0", + "babel-helper-function-name": "6.22.0", + "babel-helper-optimise-call-expression": "6.22.0", + "babel-helper-replace-supers": "6.22.0", + "babel-messages": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.22.0.tgz", + "integrity": "sha1-fDg+lim7pIIMEbBCW91ikPfwV+c=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-template": "6.22.0" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.22.0.tgz", + "integrity": "sha1-jgry+IWgss+ZnUfEwd0jzojPpMY=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.22.0.tgz", + "integrity": "sha1-ZyOXAxwhYQ1y3Su7C6n7Ynfhw2s=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.22.0.tgz", + "integrity": "sha1-GARnrWOu6lkqHK7uS/HIs+JhYmU=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.22.0.tgz", + "integrity": "sha1-9fzIsJCT+aI8dqw9njksPsS3cQQ=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.22.0", + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.22.0.tgz", + "integrity": "sha1-v2nNNIiaQcM9kN+3QOAJHM/1LyE=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.22.0.tgz", + "integrity": "sha1-bKBOIrjiFPtQFpcwZX56B9yUEUU=", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.22.0.tgz", + "integrity": "sha1-gQzQzQJaCDg7hCNrksbjH4jmRK0=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.22.0.tgz", + "integrity": "sha1-YNC6O9IyWHGcZDkdm/SS1kjcD64=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.22.0.tgz", + "integrity": "sha1-2qYOEUoELqdp3VP+Uo/IIxHrmPw=", + "dev": true, + "requires": { + "babel-helper-replace-supers": "6.22.0", + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.22.0.tgz", + "integrity": "sha1-VwdgaSMgGQlPJ9qMaLtxYv4gjbs=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "6.22.0", + "babel-helper-get-function-arity": "6.22.0", + "babel-runtime": "6.22.0", + "babel-template": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.22.0.tgz", + "integrity": "sha1-i6d24K/6pgv/IekhQDuKZSov9yM=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.22.0.tgz", + "integrity": "sha1-qzFoKehm7j9LnrlpOXV9GaW8RZM=", + "dev": true, + "requires": { + "babel-helper-regex": "6.22.0", + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.22.0.tgz", + "integrity": "sha1-h/ryM207apf2jE2QawzQ7ermduE=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.22.0.tgz", + "integrity": "sha1-jZzCfn7h3s/mVFT7mGRSoEphPSA=", + "dev": true, + "requires": { + "babel-helper-regex": "6.22.0", + "babel-runtime": "6.22.0", + "regexpu-core": "2.0.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.22.0.tgz", + "integrity": "sha1-ZXQFk6MZxEUiFXU41pC4QJRhfqY=", + "dev": true, + "requires": { + "regenerator-transform": "0.9.8" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz", + "integrity": "sha1-4AjfATQP3IfpWdplmRt+BZcMjHw=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0" + } + }, + "babel-preset-es2015": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.22.0.tgz", + "integrity": "sha1-r1qY7LNeuK92StiloF6zbcQ4aDU=", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoping": "6.22.0", + "babel-plugin-transform-es2015-classes": "6.22.0", + "babel-plugin-transform-es2015-computed-properties": "6.22.0", + "babel-plugin-transform-es2015-destructuring": "6.22.0", + "babel-plugin-transform-es2015-duplicate-keys": "6.22.0", + "babel-plugin-transform-es2015-for-of": "6.22.0", + "babel-plugin-transform-es2015-function-name": "6.22.0", + "babel-plugin-transform-es2015-literals": "6.22.0", + "babel-plugin-transform-es2015-modules-amd": "6.22.0", + "babel-plugin-transform-es2015-modules-commonjs": "6.22.0", + "babel-plugin-transform-es2015-modules-systemjs": "6.22.0", + "babel-plugin-transform-es2015-modules-umd": "6.22.0", + "babel-plugin-transform-es2015-object-super": "6.22.0", + "babel-plugin-transform-es2015-parameters": "6.22.0", + "babel-plugin-transform-es2015-shorthand-properties": "6.22.0", + "babel-plugin-transform-es2015-spread": "6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "6.22.0", + "babel-plugin-transform-es2015-template-literals": "6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "6.22.0", + "babel-plugin-transform-es2015-unicode-regex": "6.22.0", + "babel-plugin-transform-regenerator": "6.22.0" + } + }, + "babel-register": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.22.0.tgz", + "integrity": "sha1-ph3YOXX5ykqefW7/MFlJTNXqTGM=", + "dev": true, + "requires": { + "babel-core": "6.22.1", + "babel-runtime": "6.22.0", + "core-js": "2.4.1", + "home-or-tmp": "2.0.0", + "lodash": "4.16.6", + "mkdirp": "0.5.1", + "source-map-support": "0.4.11" + } + }, + "babel-runtime": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.22.0.tgz", + "integrity": "sha1-HPi0rGfHek3bDbKuH3TeUqxMphE=", + "dev": true, + "requires": { + "core-js": "2.4.1", + "regenerator-runtime": "0.10.1" + } + }, + "babel-template": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.22.0.tgz", + "integrity": "sha1-QD0RCQWkYmsxeiofy487cyBLLts=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-traverse": "6.22.1", + "babel-types": "6.22.0", + "babylon": "6.15.0", + "lodash": "4.16.6" + } + }, + "babel-traverse": { + "version": "6.22.1", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.22.1.tgz", + "integrity": "sha1-O5XNa3Qn1vH3V3BJCPL8l0il9Z8=", + "dev": true, + "requires": { + "babel-code-frame": "6.22.0", + "babel-messages": "6.22.0", + "babel-runtime": "6.22.0", + "babel-types": "6.22.0", + "babylon": "6.15.0", + "debug": "2.2.0", + "globals": "9.14.0", + "invariant": "2.2.2", + "lodash": "4.16.6" + } + }, + "babel-types": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.22.0.tgz", + "integrity": "sha1-KkR+jQ6iXSUSQJ5BdUef14zIsds=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "esutils": "2.0.2", + "lodash": "4.16.6", + "to-fast-properties": "1.0.2" + } + }, + "babylon": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.15.0.tgz", + "integrity": "sha1-umXPoagOF1mw6J+1YuJ9zK5wNI4=", + "dev": true + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "dev": true + }, + "balanced-match": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "dev": true, + "requires": { + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.0", + "pascalcase": "0.1.1" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "dev": true + }, + "base64-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.0.tgz", + "integrity": "sha1-o5mS1yNYSBGYK+XikLtqU9hnAPE=", + "dev": true + }, + "base64id": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", + "dev": true + }, + "batch": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.5.3.tgz", + "integrity": "sha1-PzQU84AyF0O/wQQvmoP/HVgk1GQ=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz", + "integrity": "sha1-PKdrhSQccXC/fZcD57mqdGMAQNQ=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.3" + } + }, + "beeper": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", + "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", + "dev": true + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dev": true, + "requires": { + "callsite": "1.0.0" + } + }, + "big.js": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz", + "integrity": "sha1-TK2iGTZS6zyp7I5VyQFWacmAaXg=", + "dev": true + }, + "bignumber.js": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.0.4.tgz", + "integrity": "sha1-fED1q80tZiOre5loLufbgbEYiaQ=", + "dev": true + }, + "binary-extensions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.8.0.tgz", + "integrity": "sha1-SOyNFt9Dd+rl+liEaCSAr02Vx3Q=", + "dev": true + }, + "blob": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=", + "dev": true + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha1-2VUfnemPH82h5oPRfukaBgLuLrk=", + "dev": true + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=", + "dev": true + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "content-type": "1.0.4", + "debug": "2.6.9", + "depd": "1.1.2", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "1.6.15" + }, + "dependencies": { + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "dev": true, + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": "1.3.1" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", + "dev": true + } + } + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", + "dev": true + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "dev": true, + "requires": { + "mime-db": "1.30.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=", + "dev": true + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", + "dev": true + }, + "type-is": { + "version": "1.6.15", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", + "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "2.1.17" + } + } + } + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "boxen": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", + "integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", + "dev": true, + "requires": { + "ansi-align": "2.0.0", + "camelcase": "4.1.0", + "chalk": "2.1.0", + "cli-boxes": "1.0.0", + "string-width": "2.1.1", + "term-size": "1.2.0", + "widest-line": "1.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha1-rFvs8U+iG5nGySynp9fP1bF+dD4=", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.4.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha1-iD992rwWUUKyphQn8zUt7RldGj4=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "brace-expansion": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", + "integrity": "sha1-cZfX6qm4fmSDkOph/GbIRCdCDfk=", + "dev": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "brorand": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.6.tgz", + "integrity": "sha1-QChwa5FfkfezSaLgvzw3YDnSFuU=", + "dev": true + }, + "browserify-aes": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.6.tgz", + "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", + "dev": true, + "requires": { + "buffer-xor": "1.0.3", + "cipher-base": "1.0.3", + "create-hash": "1.1.2", + "evp_bytestokey": "1.0.0", + "inherits": "2.0.3" + } + }, + "browserify-cipher": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.0.tgz", + "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", + "dev": true, + "requires": { + "browserify-aes": "1.0.6", + "browserify-des": "1.0.0", + "evp_bytestokey": "1.0.0" + } + }, + "browserify-des": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.0.tgz", + "integrity": "sha1-2qJ3cXRwki7S/hhZQRihdUOXId0=", + "dev": true, + "requires": { + "cipher-base": "1.0.3", + "des.js": "1.0.0", + "inherits": "2.0.3" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "randombytes": "2.0.3" + } + }, + "browserify-sign": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.0.tgz", + "integrity": "sha1-EHc5EMPCBtVCCkaq2GlPgguFlo8=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "browserify-rsa": "4.0.1", + "create-hash": "1.1.2", + "create-hmac": "1.1.4", + "elliptic": "6.3.2", + "inherits": "2.0.3", + "parse-asn1": "5.0.0" + } + }, + "browserify-zlib": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "dev": true, + "requires": { + "pako": "0.2.9" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "1.2.0", + "ieee754": "1.1.8", + "isarray": "1.0.0" + } + }, + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "bufferstreams": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bufferstreams/-/bufferstreams-1.1.0.tgz", + "integrity": "sha1-BzzRIDCMBnjufXxItp4G60U4reA=", + "dev": true, + "requires": { + "readable-stream": "2.1.5" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "bytes": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.3.0.tgz", + "integrity": "sha1-1baAoWW2IBc5rLYRVCqrwtjOsHA=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "dev": true, + "requires": { + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, + "camel-case": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", + "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", + "dev": true, + "requires": { + "no-case": "2.3.0", + "upper-case": "1.1.3" + } + }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "2.1.1", + "map-obj": "1.0.1" + } + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "dev": true + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=", + "dev": true + }, + "chokidar": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.6.1.tgz", + "integrity": "sha1-L0RHq16W5Q+z14n9kNTHLg5McMI=", + "dev": true, + "requires": { + "anymatch": "1.3.0", + "async-each": "1.0.1", + "fsevents": "1.1.3", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0" + } + }, + "cipher-base": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.3.tgz", + "integrity": "sha1-7qvxlEGc6QDaMBjCB9IS8qbfCgc=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha1-gVyZ6oT2gJUp0vRXkb34JxE1LWY=", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" + }, + "dependencies": { + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + } + } + }, + "clean-css": { + "version": "3.4.21", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.21.tgz", + "integrity": "sha1-IQHV29GdY9vBanXr1XDnwzlI9ls=", + "dev": true, + "requires": { + "commander": "2.8.1", + "source-map": "0.4.4" + }, + "dependencies": { + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + } + } + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "1.0.1" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.0.0" + } + }, + "clone": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", + "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "combine-lists": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/combine-lists/-/combine-lists-1.0.1.tgz", + "integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=", + "dev": true, + "requires": { + "lodash": "4.16.6" + } + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "dev": true + }, + "component-emitter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", + "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=", + "dev": true + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "dev": true + }, + "compressible": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.9.tgz", + "integrity": "sha1-baq04rWZwncN2eIeeokbHFp1VCU=", + "dev": true, + "requires": { + "mime-db": "1.24.0" + } + }, + "compression": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.6.2.tgz", + "integrity": "sha1-zOsSHsydCcUtetDDNQ6pPd1AK8M=", + "dev": true, + "requires": { + "accepts": "1.3.3", + "bytes": "2.3.0", + "compressible": "2.0.9", + "debug": "2.2.0", + "on-headers": "1.0.1", + "vary": "1.1.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + } + } + }, + "configstore": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", + "integrity": "sha1-CU7mYquD+tmRdnjeEU+q6o/NypA=", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "graceful-fs": "4.1.10", + "make-dir": "1.0.0", + "unique-string": "1.0.0", + "write-file-atomic": "2.3.0", + "xdg-basedir": "3.0.0" + } + }, + "connect": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.6.5.tgz", + "integrity": "sha1-+43ee6B2OHfQ7J352sC0tA5yx9o=", + "dev": true, + "requires": { + "debug": "2.6.9", + "finalhandler": "1.0.6", + "parseurl": "1.3.2", + "utils-merge": "1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "finalhandler": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", + "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "1.0.1", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.3.1", + "unpipe": "1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", + "dev": true + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + } + } + }, + "connect-history-api-fallback": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.3.0.tgz", + "integrity": "sha1-5R0X+PDvDbkKZP20feMFFVbp8Wk=", + "dev": true + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "0.1.4" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=", + "dev": true + }, + "content-type": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz", + "integrity": "sha1-t9ETrueo3Se9IRM8TcJSnfFyHu0=", + "dev": true + }, + "convert-source-map": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.3.0.tgz", + "integrity": "sha1-6fPpxuJyjvwmdmlqcOs4L3MQamc=", + "dev": true + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cors": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.1.tgz", + "integrity": "sha1-YYGqVqu0WiglvjMEcDdHrk6dI4M=", + "dev": true, + "requires": { + "vary": "1.1.0" + }, + "dependencies": { + "vary": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.0.tgz", + "integrity": "sha1-4eWv+70WrnaN0mdDlLmtMCJlMUA=", + "dev": true + } + } + }, + "create-ecdh": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", + "integrity": "sha1-iIxyNZbN92EvZJgjPuvXo1MBc30=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "elliptic": "6.3.2" + } + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "1.0.0" + } + }, + "create-hash": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.2.tgz", + "integrity": "sha1-USEAYte7dHn2xlu0GpIgix1hq60=", + "dev": true, + "requires": { + "cipher-base": "1.0.3", + "inherits": "2.0.3", + "ripemd160": "1.0.1", + "sha.js": "2.4.8" + } + }, + "create-hmac": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.4.tgz", + "integrity": "sha1-0/tLolPriz9W456i+8uK90e9MXA=", + "dev": true, + "requires": { + "create-hash": "1.1.2", + "inherits": "2.0.3" + } + }, + "cross-spawn": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", + "dev": true, + "requires": { + "lru-cache": "4.0.1", + "which": "1.2.11" + } + }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=", + "dev": true + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "crypto-browserify": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.11.0.tgz", + "integrity": "sha1-NlKgkGq5sqfgw85mpAjpV6JIVSI=", + "dev": true, + "requires": { + "browserify-cipher": "1.0.0", + "browserify-sign": "4.0.0", + "create-ecdh": "4.0.0", + "create-hash": "1.1.2", + "create-hmac": "1.1.4", + "diffie-hellman": "5.0.2", + "inherits": "2.0.3", + "pbkdf2": "3.0.9", + "public-encrypt": "4.0.0", + "randombytes": "2.0.3" + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, + "css-loader": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-0.25.0.tgz", + "integrity": "sha1-w/68jOKPTINXa2sTcH9H+Qw5AiM=", + "dev": true, + "requires": { + "babel-code-frame": "6.16.0", + "css-selector-tokenizer": "0.6.0", + "cssnano": "3.7.7", + "loader-utils": "0.2.16", + "lodash.camelcase": "3.0.1", + "object-assign": "4.1.0", + "postcss": "5.2.4", + "postcss-modules-extract-imports": "1.0.1", + "postcss-modules-local-by-default": "1.1.1", + "postcss-modules-scope": "1.0.2", + "postcss-modules-values": "1.2.2", + "source-list-map": "0.1.6" + }, + "dependencies": { + "babel-code-frame": { + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.16.0.tgz", + "integrity": "sha1-+Q5g2ghikJ084JhzO105h8l8uN4=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "2.0.0" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "js-tokens": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-2.0.0.tgz", + "integrity": "sha1-eZA/VWPud4zBFi5tzxoAJ8l/nLU=", + "dev": true + } + } + }, + "css-selector-tokenizer": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.6.0.tgz", + "integrity": "sha1-ZEX1gseTDSQdzFAHpD1vy48HMVI=", + "dev": true, + "requires": { + "cssesc": "0.1.0", + "fastparse": "1.1.1", + "regexpu-core": "1.0.0" + }, + "dependencies": { + "cssesc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", + "integrity": "sha1-yBSQPkViM3GgR3tAEJqq++6t27Q=", + "dev": true + }, + "fastparse": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz", + "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=", + "dev": true + }, + "regexpu-core": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", + "dev": true, + "requires": { + "regenerate": "1.3.1", + "regjsgen": "0.2.0", + "regjsparser": "0.1.5" + }, + "dependencies": { + "regenerate": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.1.tgz", + "integrity": "sha1-AwAgOl0v3PiRFtzoQnXQEfWQPzM=", + "dev": true + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + } + } + } + } + }, + "cssnano": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-3.7.7.tgz", + "integrity": "sha1-J/rGETgMaknW9yLAU35amIp4UBA=", + "dev": true, + "requires": { + "autoprefixer": "6.5.1", + "decamelize": "1.2.0", + "defined": "1.0.0", + "has": "1.0.1", + "object-assign": "4.1.0", + "postcss": "5.2.4", + "postcss-calc": "5.3.1", + "postcss-colormin": "2.2.1", + "postcss-convert-values": "2.4.1", + "postcss-discard-comments": "2.0.4", + "postcss-discard-duplicates": "2.0.1", + "postcss-discard-empty": "2.1.0", + "postcss-discard-overridden": "0.1.1", + "postcss-discard-unused": "2.2.1", + "postcss-filter-plugins": "2.0.2", + "postcss-merge-idents": "2.1.7", + "postcss-merge-longhand": "2.0.1", + "postcss-merge-rules": "2.0.10", + "postcss-minify-font-values": "1.0.5", + "postcss-minify-gradients": "1.0.3", + "postcss-minify-params": "1.0.5", + "postcss-minify-selectors": "2.0.5", + "postcss-normalize-charset": "1.1.0", + "postcss-normalize-url": "3.0.7", + "postcss-ordered-values": "2.2.2", + "postcss-reduce-idents": "2.3.0", + "postcss-reduce-initial": "1.0.0", + "postcss-reduce-transforms": "1.0.3", + "postcss-svgo": "2.1.5", + "postcss-unique-selectors": "2.0.2", + "postcss-value-parser": "3.3.0", + "postcss-zindex": "2.1.1" + }, + "dependencies": { + "autoprefixer": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.5.1.tgz", + "integrity": "sha1-rnWaUiHnCfPaF8LWViMOZ8Q8u3U=", + "dev": true, + "requires": { + "browserslist": "1.4.0", + "caniuse-db": "1.0.30000559", + "normalize-range": "0.1.2", + "num2fraction": "1.2.2", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + }, + "dependencies": { + "browserslist": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.4.0.tgz", + "integrity": "sha1-nP3PU4TZFY9bcNoqoAsw6P8BkEk=", + "dev": true, + "requires": { + "caniuse-db": "1.0.30000559" + } + }, + "caniuse-db": { + "version": "1.0.30000559", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000559.tgz", + "integrity": "sha1-r71okW3SO/1UnCZSDHhjH7Xi45M=", + "dev": true + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "dev": true + } + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "dev": true, + "requires": { + "function-bind": "1.1.0" + }, + "dependencies": { + "function-bind": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", + "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=", + "dev": true + } + } + }, + "postcss-calc": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-5.3.1.tgz", + "integrity": "sha1-d7rnypKK2FcW4v2kLyYb98HWW14=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "postcss-message-helpers": "2.0.0", + "reduce-css-calc": "1.3.0" + }, + "dependencies": { + "postcss-message-helpers": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-message-helpers/-/postcss-message-helpers-2.0.0.tgz", + "integrity": "sha1-pPL0+rbk/gAvCu0ABHjN9S+bpg4=", + "dev": true + }, + "reduce-css-calc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz", + "integrity": "sha1-dHyRTgSWFKTJz7umKYca0dKSdxY=", + "dev": true, + "requires": { + "balanced-match": "0.4.2", + "math-expression-evaluator": "1.2.14", + "reduce-function-call": "1.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "dev": true + }, + "math-expression-evaluator": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.14.tgz", + "integrity": "sha1-OVEXce2WAkBfupr//xfrTSo4Q6s=", + "dev": true, + "requires": { + "lodash.indexof": "4.0.5" + }, + "dependencies": { + "lodash.indexof": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/lodash.indexof/-/lodash.indexof-4.0.5.tgz", + "integrity": "sha1-U3FK3Czd1u2HY4+JOqm2wk4x7zw=", + "dev": true + } + } + }, + "reduce-function-call": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz", + "integrity": "sha1-+gLhJuaVgkJjyrkdOlsP3B3Sepo=", + "dev": true, + "requires": { + "balanced-match": "0.1.0" + }, + "dependencies": { + "balanced-match": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.1.0.tgz", + "integrity": "sha1-tQS9BYabOSWd0MXvw12EMXbczEo=", + "dev": true + } + } + } + } + } + } + }, + "postcss-colormin": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-2.2.1.tgz", + "integrity": "sha1-3FQhtq5vd572v9RzUrlKvlnQMWs=", + "dev": true, + "requires": { + "colormin": "1.1.2", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + }, + "dependencies": { + "colormin": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colormin/-/colormin-1.1.2.tgz", + "integrity": "sha1-6i90IKcrlogaOKrlnsEkpvcpgTM=", + "dev": true, + "requires": { + "color": "0.11.3", + "css-color-names": "0.0.4", + "has": "1.0.1" + }, + "dependencies": { + "color": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/color/-/color-0.11.3.tgz", + "integrity": "sha1-S60dDVJJndANvW8IaEQkZ+STlOY=", + "dev": true, + "requires": { + "clone": "1.0.2", + "color-convert": "1.5.0", + "color-string": "0.3.0" + }, + "dependencies": { + "clone": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", + "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "dev": true + }, + "color-convert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.5.0.tgz", + "integrity": "sha1-eitO+0SI34W8pkQ8sDi3EA++feE=", + "dev": true + }, + "color-string": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-0.3.0.tgz", + "integrity": "sha1-J9RvtnAlxcL6JZk7+/V55HhBuZE=", + "dev": true, + "requires": { + "color-name": "1.1.1" + }, + "dependencies": { + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", + "dev": true + } + } + } + } + }, + "css-color-names": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", + "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", + "dev": true + } + } + } + } + }, + "postcss-convert-values": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-2.4.1.tgz", + "integrity": "sha1-Rdzk1OM7fZZ7l6TZN/Jw6pjS/no=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-discard-comments": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-2.0.4.tgz", + "integrity": "sha1-vv6J+v1bPazlzM5Rt2uBUUvgDj0=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-discard-duplicates": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-2.0.1.tgz", + "integrity": "sha1-X64/GnHfPhnP+zcwnRp9ulbEWJw=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-discard-empty": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-2.1.0.tgz", + "integrity": "sha1-0rS9nVztXr2Nyt52QMfXzX9PkrU=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-discard-overridden": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-0.1.1.tgz", + "integrity": "sha1-ix6vVU9ob7KIzYdMVWZ7CqNmjVg=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-discard-unused": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/postcss-discard-unused/-/postcss-discard-unused-2.2.1.tgz", + "integrity": "sha1-XQIfAhpu1s7HMQ1GA3lKdd3VMjI=", + "dev": true, + "requires": { + "flatten": "1.0.2", + "postcss": "5.2.4", + "uniqs": "2.0.0" + }, + "dependencies": { + "flatten": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", + "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", + "dev": true + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + } + } + }, + "postcss-filter-plugins": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/postcss-filter-plugins/-/postcss-filter-plugins-2.0.2.tgz", + "integrity": "sha1-bYWGJTTXNaxCDkqFgG4fXUKG2Ew=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "uniqid": "4.1.0" + }, + "dependencies": { + "uniqid": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/uniqid/-/uniqid-4.1.0.tgz", + "integrity": "sha1-M9lnn2UCL0iYigP9JOfcr48Qnso=", + "dev": true, + "requires": { + "macaddress": "0.2.8" + }, + "dependencies": { + "macaddress": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.2.8.tgz", + "integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=", + "dev": true + } + } + } + } + }, + "postcss-merge-idents": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-2.1.7.tgz", + "integrity": "sha1-TFUwMTwI4dWzu/PSu8dH4njuonA=", + "dev": true, + "requires": { + "has": "1.0.1", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-merge-longhand": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-2.0.1.tgz", + "integrity": "sha1-/1m13sbVhs4s6hgxOPVcWHb6nNw=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-merge-rules": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-2.0.10.tgz", + "integrity": "sha1-VLNgvoBOfmmlxyImNSR7kqNWnps=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "vendors": "1.0.1" + }, + "dependencies": { + "vendors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.1.tgz", + "integrity": "sha1-N61zyO5Bf7PVgOeFMSMH0nSEfyI=", + "dev": true + } + } + }, + "postcss-minify-font-values": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-1.0.5.tgz", + "integrity": "sha1-S1jttWZB66fIR0qzUmyv17vey2k=", + "dev": true, + "requires": { + "object-assign": "4.1.0", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-minify-gradients": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-1.0.3.tgz", + "integrity": "sha1-CdIoFIyUL6gSZnnen/dzi1SRn+M=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-minify-params": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-1.0.5.tgz", + "integrity": "sha1-gtYCZDuGFqYfs2NNft4CiYNtZ/k=", + "dev": true, + "requires": { + "alphanum-sort": "1.0.2", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0", + "uniqs": "2.0.0" + }, + "dependencies": { + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + } + } + }, + "postcss-minify-selectors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-2.0.5.tgz", + "integrity": "sha1-Th+Wb7SclSZoBAFrqaPGZFu2AeA=", + "dev": true, + "requires": { + "alphanum-sort": "1.0.2", + "postcss": "5.2.4", + "postcss-selector-parser": "2.2.1" + }, + "dependencies": { + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true + }, + "postcss-selector-parser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-2.2.1.tgz", + "integrity": "sha1-/b9pYQOxKwpkBg5WEFB/QQSR98g=", + "dev": true, + "requires": { + "flatten": "1.0.2", + "indexes-of": "1.0.1", + "uniq": "1.0.1" + }, + "dependencies": { + "flatten": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", + "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", + "dev": true + }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + } + } + } + } + }, + "postcss-normalize-charset": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-1.1.0.tgz", + "integrity": "sha1-L70w4SJIxEKYHTHqJITUb9BiiXA=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-normalize-url": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-3.0.7.tgz", + "integrity": "sha1-a9kNCkvFod8iwm6mXFMlfcOCn04=", + "dev": true, + "requires": { + "is-absolute-url": "2.0.0", + "normalize-url": "1.6.1", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + }, + "dependencies": { + "is-absolute-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.0.0.tgz", + "integrity": "sha1-nEsgsOXAy++aR5o2ft5vmRZ581k=", + "dev": true + }, + "normalize-url": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.6.1.tgz", + "integrity": "sha1-qfJU+gZbvCk0RhwMCUI4FZdhVaI=", + "dev": true, + "requires": { + "object-assign": "4.1.0", + "prepend-http": "1.0.4", + "query-string": "4.2.3", + "sort-keys": "1.1.2" + }, + "dependencies": { + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "query-string": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.2.3.tgz", + "integrity": "sha1-nycnPSB6JajuTHuMdNzUXVVtuCI=", + "dev": true, + "requires": { + "object-assign": "4.1.0", + "strict-uri-encode": "1.1.0" + }, + "dependencies": { + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true + } + } + }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "1.1.0" + }, + "dependencies": { + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + } + } + } + } + } + } + }, + "postcss-ordered-values": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-2.2.2.tgz", + "integrity": "sha1-votRF0H6strI5hSiMC6dECZ7B3E=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-reduce-idents": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-idents/-/postcss-reduce-idents-2.3.0.tgz", + "integrity": "sha1-ppe1KVPtaCX/6kBOJqTxBdi41Wk=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-reduce-initial": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-1.0.0.tgz", + "integrity": "sha1-j3Obk4KJ7y5Ik21xAXg+R0HKm7s=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-reduce-transforms": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-1.0.3.tgz", + "integrity": "sha1-/Bk+Q1qXPBD5gBx0cAqDD3lkM0M=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-svgo": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.5.tgz", + "integrity": "sha1-RvwDY/Abq2o2qauwHCKfzEU2MJQ=", + "dev": true, + "requires": { + "is-svg": "2.0.1", + "postcss": "5.2.4", + "postcss-value-parser": "3.3.0", + "svgo": "0.7.1" + }, + "dependencies": { + "is-svg": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-2.0.1.tgz", + "integrity": "sha1-+Tqzvx1rvKMOl1PNNIWxMA7rwBM=", + "dev": true, + "requires": { + "html-comment-regex": "1.1.1" + }, + "dependencies": { + "html-comment-regex": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz", + "integrity": "sha1-ZouTd26q5V696POtRkswekljYl4=", + "dev": true + } + } + }, + "svgo": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-0.7.1.tgz", + "integrity": "sha1-KHMg/tlyywl+csK7FoX5b+CPgDQ=", + "dev": true, + "requires": { + "coa": "1.0.1", + "colors": "1.1.2", + "csso": "2.2.1", + "js-yaml": "3.6.1", + "mkdirp": "0.5.1", + "sax": "1.2.1", + "whet.extend": "0.9.9" + }, + "dependencies": { + "coa": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/coa/-/coa-1.0.1.tgz", + "integrity": "sha1-f5WTRs/IcZ4/cjPNaFKFSnxn2KM=", + "dev": true, + "requires": { + "q": "1.4.1" + }, + "dependencies": { + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "dev": true + } + } + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "csso": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/csso/-/csso-2.2.1.tgz", + "integrity": "sha1-Ufu1NH5Q6B5u1RZopISQrm/ir+I=", + "dev": true, + "requires": { + "clap": "1.1.1", + "source-map": "0.5.6" + }, + "dependencies": { + "clap": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/clap/-/clap-1.1.1.tgz", + "integrity": "sha1-qKk+C/t1gawZnE8AGlUlpyTOaW0=", + "dev": true, + "requires": { + "chalk": "1.1.3" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + } + } + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + } + } + }, + "js-yaml": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", + "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "2.7.3" + }, + "dependencies": { + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=", + "dev": true + }, + "whet.extend": { + "version": "0.9.9", + "resolved": "https://registry.npmjs.org/whet.extend/-/whet.extend-0.9.9.tgz", + "integrity": "sha1-+HfVv2SMl+WqVC+twW1qJZucEaE=", + "dev": true + } + } + } + } + }, + "postcss-unique-selectors": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-2.0.2.tgz", + "integrity": "sha1-mB1X0p3csz57Hf4f1DuGSfkzyh0=", + "dev": true, + "requires": { + "alphanum-sort": "1.0.2", + "postcss": "5.2.4", + "uniqs": "2.0.0" + }, + "dependencies": { + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + } + } + }, + "postcss-value-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", + "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=", + "dev": true + }, + "postcss-zindex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-2.1.1.tgz", + "integrity": "sha1-6j++ZWyXOKqHKeLuluwqRgibcg8=", + "dev": true, + "requires": { + "postcss": "5.2.4", + "uniqs": "2.0.0" + }, + "dependencies": { + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + } + } + } + } + }, + "loader-utils": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.16.tgz", + "integrity": "sha1-8IYyBm7YKCg13/iN+1JwR2Wt7m0=", + "dev": true, + "requires": { + "big.js": "3.1.3", + "emojis-list": "2.1.0", + "json5": "0.5.0", + "object-assign": "4.1.0" + }, + "dependencies": { + "big.js": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz", + "integrity": "sha1-TK2iGTZS6zyp7I5VyQFWacmAaXg=", + "dev": true + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "json5": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.0.tgz", + "integrity": "sha1-myBxWwJsvjd4/Xae3M2CLYMypbI=", + "dev": true + } + } + }, + "lodash.camelcase": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-3.0.1.tgz", + "integrity": "sha1-kyyLh/ikN3iXxnGXUzKC+Xrqwpg=", + "dev": true, + "requires": { + "lodash._createcompounder": "3.0.0" + }, + "dependencies": { + "lodash._createcompounder": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._createcompounder/-/lodash._createcompounder-3.0.0.tgz", + "integrity": "sha1-XdLLVTctbnDg4jkvsjBNZjEJEHU=", + "dev": true, + "requires": { + "lodash.deburr": "3.2.0", + "lodash.words": "3.2.0" + }, + "dependencies": { + "lodash.deburr": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-3.2.0.tgz", + "integrity": "sha1-baj1QzSjZqfPTEx2742Aqhs2XtU=", + "dev": true, + "requires": { + "lodash._root": "3.0.1" + }, + "dependencies": { + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", + "dev": true + } + } + }, + "lodash.words": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.words/-/lodash.words-3.2.0.tgz", + "integrity": "sha1-TiqGSbwIdFsXxpWxo86P7llmI7M=", + "dev": true, + "requires": { + "lodash._root": "3.0.1" + }, + "dependencies": { + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", + "dev": true + } + } + } + } + } + } + }, + "object-assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "dev": true + }, + "postcss": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.4.tgz", + "integrity": "sha1-jrS+4+XE4JFYWxFt8y2NskpTXyE=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "js-base64": "2.1.9", + "source-map": "0.5.6", + "supports-color": "3.1.2" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "js-base64": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.1.9.tgz", + "integrity": "sha1-8OgK4DmkvWVLXygfyT8EqRSn/M4=", + "dev": true + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + }, + "dependencies": { + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + } + } + } + } + }, + "postcss-modules-extract-imports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.0.1.tgz", + "integrity": "sha1-j7P++abdBCDT9tQ1PPH/c/Kyo0E=", + "dev": true, + "requires": { + "postcss": "5.2.4" + } + }, + "postcss-modules-local-by-default": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.1.1.tgz", + "integrity": "sha1-KaEGc/o30ZJRJlyiujFQ2QQOtM4=", + "dev": true, + "requires": { + "css-selector-tokenizer": "0.6.0", + "postcss": "5.2.4" + } + }, + "postcss-modules-scope": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-1.0.2.tgz", + "integrity": "sha1-/5dzleXgYgLXNiKQuIsejNBJ3ik=", + "dev": true, + "requires": { + "css-selector-tokenizer": "0.6.0", + "postcss": "5.2.4" + } + }, + "postcss-modules-values": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-1.2.2.tgz", + "integrity": "sha1-8OfUdv4e2IxeTH+XUzo+dyrZTKE=", + "dev": true, + "requires": { + "icss-replace-symbols": "1.0.2", + "postcss": "5.2.4" + }, + "dependencies": { + "icss-replace-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.0.2.tgz", + "integrity": "sha1-ywtgVOs69u3Jqx1i0Bkz4tTIv6U=", + "dev": true + } + } + }, + "source-list-map": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-0.1.6.tgz", + "integrity": "sha1-4eb5TwtAxNKNz49bh2bg5FY2h38=", + "dev": true + } + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "1.0.2" + } + }, + "custom-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", + "dev": true + }, + "d": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/d/-/d-0.1.1.tgz", + "integrity": "sha1-2hhMU10Y2O57oqoim5FACfrhEwk=", + "dev": true, + "requires": { + "es5-ext": "0.10.12" + } + }, + "dargs": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-5.1.0.tgz", + "integrity": "sha1-7H6lDHhWTNNsnV7Bj2Yyn63ieCk=", + "dev": true + }, + "dashdash": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.0.tgz", + "integrity": "sha1-KeSGxUGL8PNWA0qZPVFoajPoQUE=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "4.0.1", + "meow": "3.7.0" + } + }, + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "dev": true, + "requires": { + "ms": "0.7.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/deep-defaults/-/deep-defaults-1.0.4.tgz", + "integrity": "sha1-Gpdi4rbI1qTpkxuO5/+M3O4dF1A=", + "dev": true, + "requires": { + "lodash": "3.0.1" + }, + "dependencies": { + "lodash": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.0.1.tgz", + "integrity": "sha1-FNSQKKOLx0AkHRHi7NV+wG1zwZo=", + "dev": true + } + } + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "1.0.2" + } + }, + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.0", + "object-assign": "4.1.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.5.4" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "depd": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz", + "integrity": "sha1-4b2Cxqq2ztlluXuIsX7T5SjKGMM=", + "dev": true + }, + "deprecated": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", + "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", + "dev": true + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "di": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", + "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz", + "integrity": "sha1-tYNXOScM/ias9jIJn97SoH8gnl4=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "miller-rabin": "4.0.0", + "randombytes": "2.0.3" + } + }, + "doctrine": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "dev": true, + "requires": { + "esutils": "2.0.2", + "isarray": "1.0.0" + } + }, + "dom-serialize": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", + "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "dev": true, + "requires": { + "custom-event": "1.0.1", + "ent": "2.2.0", + "extend": "3.0.0", + "void-elements": "2.0.1" + } + }, + "domain-browser": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", + "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", + "dev": true + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", + "dev": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true + }, + "duplexer2": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", + "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "dev": true, + "requires": { + "readable-stream": "1.1.14" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + } + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "electron": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/electron/-/electron-1.7.9.tgz", + "integrity": "sha1-rdVOn4+D7QL2UZ7BATX2mLGTNs8=", + "dev": true, + "requires": { + "@types/node": "7.0.48", + "electron-download": "3.3.0", + "extract-zip": "1.6.6" + } + }, + "electron-download": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/electron-download/-/electron-download-3.3.0.tgz", + "integrity": "sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg=", + "dev": true, + "requires": { + "debug": "2.2.0", + "fs-extra": "0.30.0", + "home-path": "1.0.5", + "minimist": "1.2.0", + "nugget": "2.0.1", + "path-exists": "2.1.0", + "rc": "1.2.1", + "semver": "5.3.0", + "sumchecker": "1.3.1" + }, + "dependencies": { + "fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10", + "jsonfile": "2.4.0", + "klaw": "1.3.1", + "path-is-absolute": "1.0.1", + "rimraf": "2.5.4" + } + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10" + } + } + } + }, + "elliptic": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz", + "integrity": "sha1-5MgeCCnPCmWrcOmYuCMnI7XBvEg=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "brorand": "1.0.6", + "hash.js": "1.0.3", + "inherits": "2.0.3" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "encodeurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", + "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=", + "dev": true + }, + "end-of-stream": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", + "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", + "dev": true, + "requires": { + "once": "1.3.3" + }, + "dependencies": { + "once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + } + } + }, + "engine.io": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.3.tgz", + "integrity": "sha1-jef5eJXSDTm4X4ju7nd7K9QrE9Q=", + "dev": true, + "requires": { + "accepts": "1.3.3", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "2.3.3", + "engine.io-parser": "1.3.2", + "ws": "1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "engine.io-client": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.3.tgz", + "integrity": "sha1-F5jtk0USRkU9TG9jXXogH+lA1as=", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "2.3.3", + "engine.io-parser": "1.3.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parsejson": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "1.1.2", + "xmlhttprequest-ssl": "1.5.3", + "yeast": "0.1.2" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "engine.io-parser": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz", + "integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=", + "dev": true, + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "0.0.6", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.4", + "has-binary": "0.1.7", + "wtf-8": "1.0.0" + } + }, + "enhanced-resolve": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.0.3.tgz", + "integrity": "sha1-3xTAa1/F7sreEJTJxaErSz7cC2I=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10", + "memory-fs": "0.4.1", + "object-assign": "4.1.0", + "tapable": "0.2.6" + } + }, + "enqueue": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/enqueue/-/enqueue-1.0.2.tgz", + "integrity": "sha1-kBTpvOVw7pPKlubI5jrVTBkra8g=", + "dev": true, + "requires": { + "sliced": "0.0.5" + }, + "dependencies": { + "sliced": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", + "integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=", + "dev": true + } + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", + "dev": true + }, + "errno": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", + "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", + "dev": true, + "requires": { + "prr": "0.0.0" + } + }, + "error-ex": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz", + "integrity": "sha1-5ntD8+gsluo6WE/+4Ln8MyXYAtk=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "es5-ext": { + "version": "0.10.12", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.12.tgz", + "integrity": "sha1-qoRkHU23a2Krul5F/YBey6sUAEc=", + "dev": true, + "requires": { + "es6-iterator": "2.0.0", + "es6-symbol": "3.1.0" + } + }, + "es6-iterator": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.0.tgz", + "integrity": "sha1-vZaFZ9YWNeM8C4BydhPJy0sJa6w=", + "dev": true, + "requires": { + "d": "0.1.1", + "es5-ext": "0.10.12", + "es6-symbol": "3.1.0" + } + }, + "es6-map": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30", + "es6-iterator": "2.0.1", + "es6-set": "0.1.5", + "es6-symbol": "3.1.1", + "event-emitter": "0.3.5" + }, + "dependencies": { + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "0.10.30" + } + }, + "es5-ext": { + "version": "0.10.30", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", + "dev": true, + "requires": { + "es6-iterator": "2.0.1", + "es6-symbol": "3.1.1" + } + }, + "es6-iterator": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30", + "es6-symbol": "3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30" + } + } + } + }, + "es6-promise": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", + "integrity": "sha1-iBHpCRXZoNujYnTwskLb2nj5ySo=", + "dev": true + }, + "es6-set": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30", + "es6-iterator": "2.0.1", + "es6-symbol": "3.1.1", + "event-emitter": "0.3.5" + }, + "dependencies": { + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "0.10.30" + } + }, + "es5-ext": { + "version": "0.10.30", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", + "dev": true, + "requires": { + "es6-iterator": "2.0.1", + "es6-symbol": "3.1.1" + } + }, + "es6-iterator": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30", + "es6-symbol": "3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30" + } + } + } + }, + "es6-symbol": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.0.tgz", + "integrity": "sha1-lEgcZV56fK2C66gy2X1UM0ltf/o=", + "dev": true, + "requires": { + "d": "0.1.1", + "es5-ext": "0.10.12" + } + }, + "es6-templates": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/es6-templates/-/es6-templates-0.2.3.tgz", + "integrity": "sha1-XLmsn7He1usSOTQrgdeSu7QHjuQ=", + "dev": true, + "requires": { + "recast": "0.11.18", + "through": "2.3.8" + } + }, + "es6-weak-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30", + "es6-iterator": "2.0.1", + "es6-symbol": "3.1.1" + }, + "dependencies": { + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "0.10.30" + } + }, + "es5-ext": { + "version": "0.10.30", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", + "dev": true, + "requires": { + "es6-iterator": "2.0.1", + "es6-symbol": "3.1.1" + } + }, + "es6-iterator": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30", + "es6-symbol": "3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30" + } + } + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escope": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", + "dev": true, + "requires": { + "es6-map": "0.1.5", + "es6-weak-map": "2.0.2", + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "eslint": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", + "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", + "dev": true, + "requires": { + "babel-code-frame": "6.22.0", + "chalk": "1.1.3", + "concat-stream": "1.6.0", + "debug": "2.2.0", + "doctrine": "2.0.0", + "escope": "3.6.0", + "espree": "3.5.1", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "glob": "7.1.1", + "globals": "9.14.0", + "ignore": "3.3.5", + "imurmurhash": "0.1.4", + "inquirer": "0.12.0", + "is-my-json-valid": "2.15.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.16.6", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "1.2.1", + "progress": "1.1.8", + "require-uncached": "1.0.3", + "shelljs": "0.7.8", + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1", + "table": "3.8.3", + "text-table": "0.2.0", + "user-home": "2.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "eslint-config-angular": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/eslint-config-angular/-/eslint-config-angular-0.5.0.tgz", + "integrity": "sha1-4KrgEy4550Z98/dUf+yBpE02hcQ=", + "dev": true + }, + "eslint-config-google": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.6.0.tgz", + "integrity": "sha1-xULsGPsyR5g6wWu6MWYtAWJbdj8=", + "dev": true, + "requires": { + "eslint-config-xo": "0.13.0" + }, + "dependencies": { + "eslint-config-xo": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/eslint-config-xo/-/eslint-config-xo-0.13.0.tgz", + "integrity": "sha1-+RZ2VDK6Z9L8enF3uLz+8/brBWQ=", + "dev": true + } + } + }, + "eslint-config-loopback": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-loopback/-/eslint-config-loopback-4.0.0.tgz", + "integrity": "sha1-0iwQUq19TNELij7KJStKkYSey9I=", + "dev": true + }, + "eslint-config-xo": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/eslint-config-xo/-/eslint-config-xo-0.17.0.tgz", + "integrity": "sha1-Hn1Khr9JF5gFxGIugyp7G+606IE=", + "dev": true + }, + "eslint-plugin-angular": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-angular/-/eslint-plugin-angular-1.4.1.tgz", + "integrity": "sha1-ekJ55yLUXg5Bm9Nik3PvXQZqoOM=", + "dev": true + }, + "eslint-plugin-jasmine": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-jasmine/-/eslint-plugin-jasmine-2.8.4.tgz", + "integrity": "sha1-Z6VVHj0dXguMa1Sq66uVNw9dN94=", + "dev": true + }, + "espree": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", + "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "dev": true, + "requires": { + "acorn": "5.1.2", + "acorn-jsx": "3.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", + "integrity": "sha1-kRy1PgNoB88Pp3jcXTcPvYZCRtc=", + "dev": true + } + } + }, + "esprima": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.2.tgz", + "integrity": "sha1-lUtdGTIcpDYJL6kPBtZ5hTH+gYQ=", + "dev": true + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "4.2.0", + "object-assign": "4.1.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "etag": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.7.0.tgz", + "integrity": "sha1-A9MLX2fdbmMtKUXTDWZScxo01dg=", + "dev": true + }, + "event-emitter": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", + "dev": true, + "requires": { + "d": "1.0.0", + "es5-ext": "0.10.30" + }, + "dependencies": { + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "0.10.30" + } + }, + "es5-ext": { + "version": "0.10.30", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", + "dev": true, + "requires": { + "es6-iterator": "2.0.0", + "es6-symbol": "3.1.0" + } + } + } + }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "dev": true, + "requires": { + "duplexer": "0.1.1", + "from": "0.1.3", + "map-stream": "0.1.0", + "pause-stream": "0.0.11", + "split": "0.3.3", + "stream-combiner": "0.0.4", + "through": "2.3.8" + } + }, + "eventemitter3": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz", + "integrity": "sha1-HIaZHYFq0eUEdQ5zh0Ik7PO+xQg=", + "dev": true + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "eventsource": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-0.1.6.tgz", + "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", + "dev": true, + "requires": { + "original": "1.0.0" + } + }, + "evp_bytestokey": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz", + "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", + "dev": true, + "requires": { + "create-hash": "1.1.2" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.1", + "strip-eof": "1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.0.1", + "shebang-command": "1.2.0", + "which": "1.2.11" + } + } + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-braces": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/expand-braces/-/expand-braces-0.1.2.tgz", + "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", + "dev": true, + "requires": { + "array-slice": "0.2.3", + "array-unique": "0.2.1", + "braces": "0.1.5" + }, + "dependencies": { + "braces": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-0.1.5.tgz", + "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", + "dev": true, + "requires": { + "expand-range": "0.1.1" + } + }, + "expand-range": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", + "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", + "dev": true, + "requires": { + "is-number": "0.1.1", + "repeat-string": "0.2.2" + } + }, + "is-number": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-0.1.1.tgz", + "integrity": "sha1-aaevEWlj1HIG7JvZtIoUIW8eOAY=", + "dev": true + }, + "repeat-string": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-0.2.2.tgz", + "integrity": "sha1-x6jTI2BoNiBZp+RlH8aITosftK4=", + "dev": true + } + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "2.2.3" + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dev": true, + "requires": { + "homedir-polyfill": "1.0.1" + } + }, + "express": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.14.1.tgz", + "integrity": "sha1-ZGwjf3ZvFIwhIK/wc4F7nk1+DTM=", + "dev": true, + "requires": { + "accepts": "1.3.3", + "array-flatten": "1.1.1", + "content-disposition": "0.5.2", + "content-type": "1.0.2", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.2.0", + "depd": "1.1.0", + "encodeurl": "1.0.1", + "escape-html": "1.0.3", + "etag": "1.7.0", + "finalhandler": "0.5.1", + "fresh": "0.3.0", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.1", + "path-to-regexp": "0.1.7", + "proxy-addr": "1.1.3", + "qs": "6.2.0", + "range-parser": "1.2.0", + "send": "0.14.2", + "serve-static": "1.11.2", + "type-is": "1.6.14", + "utils-merge": "1.0.0", + "vary": "1.1.0" + }, + "dependencies": { + "qs": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.0.tgz", + "integrity": "sha1-O3hIwDwt7OaalSKw+ujEEm10Xzs=", + "dev": true + } + } + }, + "extend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", + "integrity": "sha1-WkdDU7nzNT3dgXbf03uRyDpG8dQ=", + "dev": true + }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "1.1.0" + }, + "dependencies": { + "kind-of": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + } + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "extract-zip": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz", + "integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=", + "dev": true, + "requires": { + "concat-stream": "1.6.0", + "debug": "2.6.9", + "mkdirp": "0.5.0", + "yauzl": "2.4.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", + "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "extsprintf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", + "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", + "dev": true + }, + "fancy-log": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.2.0.tgz", + "integrity": "sha1-1aUbU+mrIsoH1VjytnrlX9tfy9g=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "time-stamp": "1.0.1" + } + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastparse": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz", + "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=", + "dev": true + }, + "faye-websocket": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", + "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", + "dev": true, + "requires": { + "websocket-driver": "0.6.5" + } + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "dev": true, + "requires": { + "pend": "1.2.0" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.0" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.2.2", + "object-assign": "4.1.0" + } + }, + "file-loader": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-0.9.0.tgz", + "integrity": "sha1-HS2t3UJM5tGwfP4/eXMb7TYXq0I=", + "dev": true, + "requires": { + "loader-utils": "0.2.16" + } + }, + "filename-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.0.tgz", + "integrity": "sha1-mW4+gEebmLmJfxWopYs9CE6SZ3U=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.6", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "finalhandler": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.5.1.tgz", + "integrity": "sha1-LEANjUUwk1vCMlScX6OF7Afeb80=", + "dev": true, + "requires": { + "debug": "2.2.0", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "statuses": "1.3.1", + "unpipe": "1.0.0" + } + }, + "find-cache-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-0.1.1.tgz", + "integrity": "sha1-yN765XyKUqinhPnjHFfHQumToLk=", + "dev": true, + "requires": { + "commondir": "1.0.1", + "mkdirp": "0.5.1", + "pkg-dir": "1.0.0" + } + }, + "find-index": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", + "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", + "dev": true + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + }, + "findup-sync": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", + "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", + "dev": true, + "requires": { + "detect-file": "1.0.0", + "is-glob": "3.1.0", + "micromatch": "3.1.5", + "resolve-dir": "1.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.0.tgz", + "integrity": "sha512-P4O8UQRdGiMLWSizsApmXVQDBS6KCt7dSexgLKBmH5Hr1CZq7vsnscFh8oR1sP1ab1Zj0uCHCEzZeV6SfUf3rA==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "define-property": "1.0.0", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.2", + "snapdragon": "0.8.1", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.1" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.5.tgz", + "integrity": "sha512-ykttrLPQrz1PUJcXjwsTUjGoPJ64StIGNE2lGVD1c9CuguJ+L7/navsE8IcDNndOoCMvYV0qc/exfVbMHkUhvA==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.0", + "define-property": "1.0.0", + "extend-shallow": "2.0.1", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.7", + "object.pick": "1.3.0", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "fined": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fined/-/fined-1.1.0.tgz", + "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", + "dev": true, + "requires": { + "expand-tilde": "2.0.2", + "is-plain-object": "2.0.4", + "object.defaults": "1.1.0", + "object.pick": "1.3.0", + "parse-filepath": "1.0.2" + } + }, + "first-chunk-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", + "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", + "dev": true + }, + "flagged-respawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", + "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", + "dev": true + }, + "flat-cache": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", + "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.10", + "write": "0.2.1" + } + }, + "flatpickr": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-2.6.3.tgz", + "integrity": "sha1-RXNXUy3rE189pktCW/RDVzeWFWQ=" + }, + "for-in": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.6.tgz", + "integrity": "sha1-yfluib+tGKVFr17D7TUqHZ5bTcg=", + "dev": true + }, + "for-own": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.4.tgz", + "integrity": "sha1-AUm0GjkIjHUV9R6+HBOG1F+TUHI=", + "dev": true, + "requires": { + "for-in": "0.1.6" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.1.tgz", + "integrity": "sha1-St8DQuGnmvoehMjDIKn/yCOSofM=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.12" + } + }, + "forwarded": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz", + "integrity": "sha1-Ge+YdMSuHCl7zweP3mOgm2aoQ2M=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" + } + }, + "fresh": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.3.0.tgz", + "integrity": "sha1-ZR+DjiJCTnVm3hYdg1jKoZn4PU8=", + "dev": true + }, + "from": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.3.tgz", + "integrity": "sha1-72OsIGKsMqz3hi4NQLRLiW8i87w=", + "dev": true + }, + "fs-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "dev": true, + "requires": { + "null-check": "1.0.0" + } + }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "requires": { + "graceful-fs": "4.1.10", + "jsonfile": "4.0.0", + "universalify": "0.1.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", + "integrity": "sha1-EfgjGPX+e7LNIpZaEI6TBiCCFtg=", + "dev": true, + "optional": true, + "requires": { + "nan": "2.8.0", + "node-pre-gyp": "0.6.39" + }, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.2.9" + } + }, + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.7", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "buffer-shims": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true, + "dev": true, + "optional": true + }, + "co": { + "version": "4.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true, + "optional": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.15" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.1" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fstream": "1.0.11", + "inherits": "2.0.3", + "minimatch": "3.0.4" + } + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "1.1.1", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true, + "dev": true + }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ajv": "4.11.8", + "har-schema": "1.0.5" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.0", + "sshpk": "1.13.0" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "jsprim": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "mime-db": { + "version": "1.27.0", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.15", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "1.27.0" + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "node-pre-gyp": { + "version": "0.6.39", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "1.0.2", + "hawk": "3.1.3", + "mkdirp": "0.5.1", + "nopt": "4.0.1", + "npmlog": "4.1.0", + "rc": "1.2.1", + "request": "2.81.0", + "rimraf": "2.6.1", + "semver": "5.3.0", + "tar": "2.2.1", + "tar-pack": "3.4.0" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1.1.0", + "osenv": "0.1.4" + } + }, + "npmlog": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "optional": true + }, + "qs": { + "version": "6.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.2.9", + "bundled": true, + "dev": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "1.0.1", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.81.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.15", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.0.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.6.0", + "uuid": "3.0.1" + } + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "sshpk": { + "version": "1.13.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jodid25519": "1.0.2", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.8", + "fstream": "1.0.11", + "fstream-ignore": "1.0.5", + "once": "1.4.0", + "readable-stream": "2.2.9", + "rimraf": "2.6.1", + "tar": "2.2.1", + "uid-number": "0.0.6" + } + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "dev": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "uuid": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "extsprintf": "1.0.2" + } + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.5.4" + } + }, + "function-source": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/function-source/-/function-source-0.1.0.tgz", + "integrity": "sha1-2RBL8+RniLVUaMAr8bL6vPj8Ga8=", + "dev": true + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "requires": { + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.0", + "signal-exit": "3.0.1", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "gaze": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.2.tgz", + "integrity": "sha1-hHIkZ3rbiHDWeSV+0ziP22HkAQU=", + "dev": true, + "requires": { + "globule": "1.2.0" + } + }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", + "dev": true + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "dev": true, + "requires": { + "is-property": "1.0.2" + } + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", + "integrity": "sha1-KD/9n8ElaECHUxHBtg6MQBhxEOY=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.3", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "glob-stream": { + "version": "3.1.18", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", + "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", + "dev": true, + "requires": { + "glob": "4.5.3", + "glob2base": "0.0.12", + "minimatch": "2.0.10", + "ordered-read-streams": "0.1.0", + "through2": "0.6.5", + "unique-stream": "1.0.0" + }, + "dependencies": { + "glob": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", + "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", + "dev": true, + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "2.0.10", + "once": "1.4.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "minimatch": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", + "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "dev": true, + "requires": { + "brace-expansion": "1.1.6" + } + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + } + } + } + }, + "glob-watcher": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", + "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", + "dev": true, + "requires": { + "gaze": "0.5.2" + }, + "dependencies": { + "gaze": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", + "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "dev": true, + "requires": { + "globule": "0.1.0" + } + }, + "glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "dev": true, + "requires": { + "graceful-fs": "1.2.3", + "inherits": "1.0.2", + "minimatch": "0.2.14" + } + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "dev": true, + "requires": { + "glob": "3.1.21", + "lodash": "1.0.2", + "minimatch": "0.2.14" + } + }, + "graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", + "dev": true + }, + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", + "dev": true + }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", + "dev": true + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "dev": true, + "requires": { + "lru-cache": "2.7.3", + "sigmund": "1.0.1" + } + } + } + }, + "glob2base": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", + "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "dev": true, + "requires": { + "find-index": "0.1.1" + } + }, + "global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "dev": true, + "requires": { + "global-prefix": "1.0.2", + "is-windows": "1.0.1", + "resolve-dir": "1.0.1" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dev": true, + "requires": { + "expand-tilde": "2.0.2", + "homedir-polyfill": "1.0.1", + "ini": "1.3.4", + "is-windows": "1.0.1", + "which": "1.3.0" + }, + "dependencies": { + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + } + } + }, + "globals": { + "version": "9.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.14.0.tgz", + "integrity": "sha1-iFmTavADh0EmMFOznQ52yiQeQDQ=", + "dev": true + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.1", + "object-assign": "4.1.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "globule": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.0.tgz", + "integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=", + "dev": true, + "requires": { + "glob": "7.1.1", + "lodash": "4.17.4", + "minimatch": "3.0.3" + }, + "dependencies": { + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + } + } + }, + "glogg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", + "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", + "dev": true, + "requires": { + "sparkles": "1.0.0" + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "3.0.2", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "unzip-response": "2.0.1", + "url-parse-lax": "1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.10.tgz", + "integrity": "sha1-8tcgwiCS90Mih3XHXjYSYyUB8TE=" + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "gulp": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", + "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", + "dev": true, + "requires": { + "archy": "1.0.0", + "chalk": "1.1.3", + "deprecated": "0.0.1", + "gulp-util": "3.0.7", + "interpret": "1.0.1", + "liftoff": "2.5.0", + "minimist": "1.2.0", + "orchestrator": "0.3.8", + "pretty-hrtime": "1.0.3", + "semver": "4.3.6", + "tildify": "1.2.0", + "v8flags": "2.1.1", + "vinyl-fs": "0.3.14" + }, + "dependencies": { + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "dev": true + } + } + }, + "gulp-concat": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.0.tgz", + "integrity": "sha1-WFz7EVQR80h3MTEUBWa2qBxpy5E=", + "dev": true, + "requires": { + "concat-with-sourcemaps": "1.0.4", + "gulp-util": "3.0.7", + "through2": "0.6.5" + }, + "dependencies": { + "concat-with-sourcemaps": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.0.4.tgz", + "integrity": "sha1-9Vs74q60dgGxCi1SWcz7cP0vHdY=", + "dev": true, + "requires": { + "source-map": "0.5.6" + }, + "dependencies": { + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + } + } + }, + "gulp-util": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.7.tgz", + "integrity": "sha1-eJJcS4+LSQBawBoBHFV+YhiUHLs=", + "dev": true, + "requires": { + "array-differ": "1.0.0", + "array-uniq": "1.0.3", + "beeper": "1.1.0", + "chalk": "1.1.3", + "dateformat": "1.0.12", + "fancy-log": "1.2.0", + "gulplog": "1.0.0", + "has-gulplog": "0.1.0", + "lodash._reescape": "3.0.0", + "lodash._reevaluate": "3.0.0", + "lodash._reinterpolate": "3.0.0", + "lodash.template": "3.6.2", + "minimist": "1.2.0", + "multipipe": "0.1.2", + "object-assign": "3.0.0", + "replace-ext": "0.0.1", + "through2": "2.0.1", + "vinyl": "0.5.3" + }, + "dependencies": { + "array-differ": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "beeper": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz", + "integrity": "sha1-nub8HOf1T+qs585zWIsFYDeGaiw=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "4.0.1", + "meow": "3.7.0" + }, + "dependencies": { + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.3.5", + "object-assign": "4.1.0", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" + }, + "dependencies": { + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "2.1.1", + "map-obj": "1.0.1" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + } + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.1" + }, + "dependencies": { + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "1.0.2" + }, + "dependencies": { + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + } + } + }, + "signal-exit": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz", + "integrity": "sha1-WkyISZK2OnrNm623iUw+6c/MrYE=", + "dev": true + } + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "normalize-package-data": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz", + "integrity": "sha1-jZJPFClg4Xd+f/4XBUNjHMfLAt8=", + "dev": true, + "requires": { + "hosted-git-info": "2.1.5", + "is-builtin-module": "1.0.0", + "semver": "5.3.0", + "validate-npm-package-license": "3.0.1" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.5.tgz", + "integrity": "sha1-C6gdkNouJas0ozLm7HeTbhWYEYs=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + } + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + }, + "dependencies": { + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + }, + "dependencies": { + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + } + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + } + } + } + } + }, + "object-assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "dev": true + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + } + } + } + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.3.5", + "path-type": "1.1.0" + }, + "dependencies": { + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.9", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha1-uqy6N9GdEfnRRtNXi8mZWMN4fik=", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.0" + }, + "dependencies": { + "error-ex": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz", + "integrity": "sha1-5ntD8+gsluo6WE/+4Ln8MyXYAtk=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + } + } + } + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + } + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + }, + "dependencies": { + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + } + } + } + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.9", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha1-uqy6N9GdEfnRRtNXi8mZWMN4fik=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + } + } + } + } + } + } + } + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "strip-indent": "1.0.1" + }, + "dependencies": { + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "2.0.1" + }, + "dependencies": { + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + }, + "dependencies": { + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + }, + "dependencies": { + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + } + } + } + } + } + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + } + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + } + } + }, + "fancy-log": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.2.0.tgz", + "integrity": "sha1-1aUbU+mrIsoH1VjytnrlX9tfy9g=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "time-stamp": "1.0.1" + }, + "dependencies": { + "time-stamp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.0.1.tgz", + "integrity": "sha1-n0vSNVnJNllm8zAtu6KwfGuZsVE=", + "dev": true + } + } + }, + "gulplog": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", + "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", + "dev": true, + "requires": { + "glogg": "1.0.0" + }, + "dependencies": { + "glogg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", + "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", + "dev": true, + "requires": { + "sparkles": "1.0.0" + }, + "dependencies": { + "sparkles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", + "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "dev": true + } + } + } + } + }, + "has-gulplog": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", + "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", + "dev": true, + "requires": { + "sparkles": "1.0.0" + }, + "dependencies": { + "sparkles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", + "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "dev": true + } + } + }, + "lodash._reescape": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", + "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", + "dev": true + }, + "lodash._reevaluate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", + "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash.template": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", + "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash._basetostring": "3.0.1", + "lodash._basevalues": "3.0.0", + "lodash._isiterateecall": "3.0.9", + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0", + "lodash.keys": "3.1.2", + "lodash.restparam": "3.6.1", + "lodash.templatesettings": "3.1.1" + }, + "dependencies": { + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basetostring": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", + "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", + "dev": true + }, + "lodash._basevalues": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", + "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.escape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", + "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "dev": true, + "requires": { + "lodash._root": "3.0.1" + }, + "dependencies": { + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", + "dev": true + } + } + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + }, + "dependencies": { + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + } + } + }, + "lodash.restparam": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", + "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", + "dev": true + }, + "lodash.templatesettings": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", + "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "dev": true, + "requires": { + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0" + } + } + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "multipipe": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", + "dev": true, + "requires": { + "duplexer2": "0.0.2" + }, + "dependencies": { + "duplexer2": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", + "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "dev": true, + "requires": { + "readable-stream": "1.1.14" + }, + "dependencies": { + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + } + } + } + } + }, + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "through2": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.1.tgz", + "integrity": "sha1-OE51MU1J8y3hLuu4E2uOtrXVnak=", + "dev": true, + "requires": { + "readable-stream": "2.0.6", + "xtend": "4.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + } + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + } + } + }, + "vinyl": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", + "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", + "dev": true, + "requires": { + "clone": "1.0.2", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + }, + "dependencies": { + "clone": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", + "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + } + } + } + } + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + } + } + } + } + }, + "gulp-extend": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/gulp-extend/-/gulp-extend-0.2.0.tgz", + "integrity": "sha1-BRHbpAj5JAP5xSDAEw3oGWYLDZA=", + "dev": true, + "requires": { + "event-stream": "3.3.4", + "gulp-util": "2.2.20", + "node.extend": "1.0.10", + "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", + "integrity": "sha1-DY6UaWej2BQ/k+JOKYUl/BsiNfk=", + "dev": true + }, + "ansi-styles": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz", + "integrity": "sha1-6uy/Zs1waIJ2Cy9GkVgrj1XXp94=", + "dev": true + }, + "chalk": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz", + "integrity": "sha1-Zjs6ZItotV0EaQ1JFnqoN4WPIXQ=", + "dev": true, + "requires": { + "ansi-styles": "1.1.0", + "escape-string-regexp": "1.0.5", + "has-ansi": "0.1.0", + "strip-ansi": "0.3.0", + "supports-color": "0.2.0" + } + }, + "gulp-util": { + "version": "2.2.20", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-2.2.20.tgz", + "integrity": "sha1-1xRuVyiRC9jwR6awseVJvCLb1kw=", + "dev": true, + "requires": { + "chalk": "0.5.1", + "dateformat": "1.0.12", + "lodash._reinterpolate": "2.4.1", + "lodash.template": "2.4.1", + "minimist": "0.2.0", + "multipipe": "0.1.2", + "through2": "0.5.1", + "vinyl": "0.2.3" + } + }, + "has-ansi": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz", + "integrity": "sha1-hPJlqujA5qiKEtcCKJS3VoiUxi4=", + "dev": true, + "requires": { + "ansi-regex": "0.2.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz", + "integrity": "sha1-TxInqlqHEfxjL1sHofRgequLMiI=", + "dev": true + }, + "lodash.escape": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-2.4.1.tgz", + "integrity": "sha1-LOEsXghNsKV92l5dHu659dF1o7Q=", + "dev": true, + "requires": { + "lodash._escapehtmlchar": "2.4.1", + "lodash._reunescapedhtml": "2.4.1", + "lodash.keys": "2.4.1" + } + }, + "lodash.keys": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", + "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", + "dev": true, + "requires": { + "lodash._isnative": "2.4.1", + "lodash._shimkeys": "2.4.1", + "lodash.isobject": "2.4.1" + } + }, + "lodash.template": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-2.4.1.tgz", + "integrity": "sha1-nmEQB+32KRKal0qzxIuBez4c8g0=", + "dev": true, + "requires": { + "lodash._escapestringchar": "2.4.1", + "lodash._reinterpolate": "2.4.1", + "lodash.defaults": "2.4.1", + "lodash.escape": "2.4.1", + "lodash.keys": "2.4.1", + "lodash.templatesettings": "2.4.1", + "lodash.values": "2.4.1" + } + }, + "lodash.templatesettings": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz", + "integrity": "sha1-6nbHXRHrhtTb6JqDiTu4YZKaxpk=", + "dev": true, + "requires": { + "lodash._reinterpolate": "2.4.1", + "lodash.escape": "2.4.1" + } + }, + "minimist": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.0.tgz", + "integrity": "sha1-Tf/lJdriuGTGbC4jxicdev3s784=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "strip-ansi": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz", + "integrity": "sha1-JfSOoiynkYfzF0pNuHWTR7sSYiA=", + "dev": true, + "requires": { + "ansi-regex": "0.2.1" + } + }, + "supports-color": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz", + "integrity": "sha1-2S3iaU6z9nMjlz1649i1W0wiGQo=", + "dev": true + }, + "through2": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz", + "integrity": "sha1-390BLrnHAOIyP9M084rGIqs3Lac=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "3.0.0" + } + }, + "vinyl": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.2.3.tgz", + "integrity": "sha1-vKk4IJWC7FpJrVOKAPofEl5RMlI=", + "dev": true, + "requires": { + "clone-stats": "0.0.1" + } + }, + "xtend": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz", + "integrity": "sha1-XM50B7r2Qsunvs2laBEcST9ZZlo=", + "dev": true + } + } + }, + "gulp-install": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/gulp-install/-/gulp-install-1.1.0.tgz", + "integrity": "sha1-k4a0bLRmm0cle2rfTj6i6DySiho=", + "dev": true, + "requires": { + "dargs": "5.1.0", + "gulp-util": "3.0.7", + "lodash.groupby": "4.6.0", + "p-queue": "1.2.0", + "through2": "2.0.3", + "which": "1.3.0" + }, + "dependencies": { + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.1.5", + "xtend": "4.0.1" + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + } + } + }, + "gulp-jasmine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/gulp-jasmine/-/gulp-jasmine-3.0.0.tgz", + "integrity": "sha1-ATFIbwzVmv/toY4AxkOZKpGWljs=", + "dev": true, + "requires": { + "arrify": "1.0.1", + "jasmine": "2.9.0", + "jasmine-terminal-reporter": "1.0.3", + "plugin-error": "0.1.2", + "through2": "2.0.1" + } + }, + "gulp-print": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/gulp-print/-/gulp-print-2.0.1.tgz", + "integrity": "sha1-Gs7ljqyK8tPErTMp2+RldYOTxBQ=", + "dev": true, + "requires": { + "gulp-util": "3.0.7", + "map-stream": "0.0.7" + }, + "dependencies": { + "map-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", + "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", + "dev": true + } + } + }, + "gulp-util": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.7.tgz", + "integrity": "sha1-eJJcS4+LSQBawBoBHFV+YhiUHLs=", + "dev": true, + "requires": { + "array-differ": "1.0.0", + "array-uniq": "1.0.3", + "beeper": "1.1.1", + "chalk": "1.1.3", + "dateformat": "1.0.12", + "fancy-log": "1.2.0", + "gulplog": "1.0.0", + "has-gulplog": "0.1.0", + "lodash._reescape": "3.0.0", + "lodash._reevaluate": "3.0.0", + "lodash._reinterpolate": "3.0.0", + "lodash.template": "3.6.2", + "minimist": "1.2.0", + "multipipe": "0.1.2", + "object-assign": "3.0.0", + "replace-ext": "0.0.1", + "through2": "2.0.1", + "vinyl": "0.5.3" + }, + "dependencies": { + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", + "dev": true + } + } + }, + "gulp-wrap": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/gulp-wrap/-/gulp-wrap-0.13.0.tgz", + "integrity": "sha1-kPsLSieiZkM4Mv98YSLbXB7olMY=", + "dev": true, + "requires": { + "consolidate": "0.14.1", + "es6-promise": "3.3.1", + "fs-readfile-promise": "2.0.1", + "gulp-util": "3.0.7", + "js-yaml": "3.6.1", + "lodash": "4.16.4", + "node.extend": "1.1.6", + "through2": "2.0.1", + "tryit": "1.0.2", + "vinyl-bufferstream": "1.0.1" + }, + "dependencies": { + "consolidate": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/consolidate/-/consolidate-0.14.1.tgz", + "integrity": "sha1-UG1SnvfiEWJNLkpfM334vhNu9yc=", + "dev": true, + "requires": { + "bluebird": "3.4.6" + }, + "dependencies": { + "bluebird": { + "version": "3.4.6", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.6.tgz", + "integrity": "sha1-AdqNgh2HgT0ViWfnQ9X+bGLPjA8=", + "dev": true + } + } + }, + "es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", + "dev": true + }, + "fs-readfile-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fs-readfile-promise/-/fs-readfile-promise-2.0.1.tgz", + "integrity": "sha1-gAI4I5gfn//+AWCei+Zo9prknnA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.9" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha1-uqy6N9GdEfnRRtNXi8mZWMN4fik=", + "dev": true + } + } + }, + "gulp-util": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.7.tgz", + "integrity": "sha1-eJJcS4+LSQBawBoBHFV+YhiUHLs=", + "dev": true, + "requires": { + "array-differ": "1.0.0", + "array-uniq": "1.0.3", + "beeper": "1.1.0", + "chalk": "1.1.3", + "dateformat": "1.0.12", + "fancy-log": "1.2.0", + "gulplog": "1.0.0", + "has-gulplog": "0.1.0", + "lodash._reescape": "3.0.0", + "lodash._reevaluate": "3.0.0", + "lodash._reinterpolate": "3.0.0", + "lodash.template": "3.6.2", + "minimist": "1.2.0", + "multipipe": "0.1.2", + "object-assign": "3.0.0", + "replace-ext": "0.0.1", + "through2": "2.0.1", + "vinyl": "0.5.3" + }, + "dependencies": { + "array-differ": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "beeper": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz", + "integrity": "sha1-nub8HOf1T+qs585zWIsFYDeGaiw=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", + "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=", + "dev": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "4.0.1", + "meow": "3.7.0" + }, + "dependencies": { + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.3.5", + "object-assign": "4.1.0", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" + }, + "dependencies": { + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "2.1.1", + "map-obj": "1.0.1" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + } + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.1" + }, + "dependencies": { + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "1.0.2" + }, + "dependencies": { + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + } + } + }, + "signal-exit": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz", + "integrity": "sha1-WkyISZK2OnrNm623iUw+6c/MrYE=", + "dev": true + } + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "normalize-package-data": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz", + "integrity": "sha1-jZJPFClg4Xd+f/4XBUNjHMfLAt8=", + "dev": true, + "requires": { + "hosted-git-info": "2.1.5", + "is-builtin-module": "1.0.0", + "semver": "5.3.0", + "validate-npm-package-license": "3.0.1" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.5.tgz", + "integrity": "sha1-C6gdkNouJas0ozLm7HeTbhWYEYs=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + } + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + }, + "dependencies": { + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + }, + "dependencies": { + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + } + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + } + } + } + } + }, + "object-assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "dev": true + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + } + } + } + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.3.5", + "path-type": "1.1.0" + }, + "dependencies": { + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.9", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha1-uqy6N9GdEfnRRtNXi8mZWMN4fik=", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.0" + }, + "dependencies": { + "error-ex": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz", + "integrity": "sha1-5ntD8+gsluo6WE/+4Ln8MyXYAtk=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + } + } + } + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + } + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + }, + "dependencies": { + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + } + } + } + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.9", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha1-uqy6N9GdEfnRRtNXi8mZWMN4fik=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + }, + "dependencies": { + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + } + } + } + } + } + } + } + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "strip-indent": "1.0.1" + }, + "dependencies": { + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "2.0.1" + }, + "dependencies": { + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + }, + "dependencies": { + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + }, + "dependencies": { + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + } + } + } + } + } + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + } + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + } + } + }, + "fancy-log": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.2.0.tgz", + "integrity": "sha1-1aUbU+mrIsoH1VjytnrlX9tfy9g=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "time-stamp": "1.0.1" + }, + "dependencies": { + "time-stamp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.0.1.tgz", + "integrity": "sha1-n0vSNVnJNllm8zAtu6KwfGuZsVE=", + "dev": true + } + } + }, + "gulplog": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", + "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", + "dev": true, + "requires": { + "glogg": "1.0.0" + }, + "dependencies": { + "glogg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", + "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", + "dev": true, + "requires": { + "sparkles": "1.0.0" + }, + "dependencies": { + "sparkles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", + "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "dev": true + } + } + } + } + }, + "has-gulplog": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", + "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", + "dev": true, + "requires": { + "sparkles": "1.0.0" + }, + "dependencies": { + "sparkles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", + "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "dev": true + } + } + }, + "lodash._reescape": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", + "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", + "dev": true + }, + "lodash._reevaluate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", + "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash.template": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", + "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash._basetostring": "3.0.1", + "lodash._basevalues": "3.0.0", + "lodash._isiterateecall": "3.0.9", + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0", + "lodash.keys": "3.1.2", + "lodash.restparam": "3.6.1", + "lodash.templatesettings": "3.1.1" + }, + "dependencies": { + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basetostring": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", + "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", + "dev": true + }, + "lodash._basevalues": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", + "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.escape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", + "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "dev": true, + "requires": { + "lodash._root": "3.0.1" + }, + "dependencies": { + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", + "dev": true + } + } + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + }, + "dependencies": { + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + } + } + }, + "lodash.restparam": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", + "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", + "dev": true + }, + "lodash.templatesettings": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", + "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "dev": true, + "requires": { + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0" + } + } + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "multipipe": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", + "dev": true, + "requires": { + "duplexer2": "0.0.2" + }, + "dependencies": { + "duplexer2": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", + "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "dev": true, + "requires": { + "readable-stream": "1.1.14" + }, + "dependencies": { + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + } + } + } + } + }, + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", + "dev": true + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "vinyl": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", + "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", + "dev": true, + "requires": { + "clone": "1.0.2", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + }, + "dependencies": { + "clone": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", + "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + } + } + } + } + }, + "js-yaml": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", + "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "2.7.3" + }, + "dependencies": { + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + } + } + }, + "lodash": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.4.tgz", + "integrity": "sha1-Ac4wa5utExnypVKGdPiCl663ASc=", + "dev": true + }, + "node.extend": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.6.tgz", + "integrity": "sha1-p7iCyC1sk6SGOlUEvV3o7IYli5Y=", + "dev": true, + "requires": { + "is": "3.1.0" + }, + "dependencies": { + "is": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is/-/is-3.1.0.tgz", + "integrity": "sha1-KUXSBdaRy/5IM+P4oRyK6UZz8qc=", + "dev": true + } + } + }, + "through2": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.1.tgz", + "integrity": "sha1-OE51MU1J8y3hLuu4E2uOtrXVnak=", + "dev": true, + "requires": { + "readable-stream": "2.0.6", + "xtend": "4.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + } + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + } + } + }, + "tryit": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.2.tgz", + "integrity": "sha1-wZawBz5rHFldk8nIMIVbeswypFM=", + "dev": true + }, + "vinyl-bufferstream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vinyl-bufferstream/-/vinyl-bufferstream-1.0.1.tgz", + "integrity": "sha1-BTeGn1gO/6TKRay0dXnkuf5jCBo=", + "dev": true, + "requires": { + "bufferstreams": "1.0.1" + }, + "dependencies": { + "bufferstreams": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bufferstreams/-/bufferstreams-1.0.1.tgz", + "integrity": "sha1-z7GtlWjTujz+k1upq92VLeiKqyo=", + "dev": true, + "requires": { + "readable-stream": "1.1.14" + }, + "dependencies": { + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + } + } + } + } + } + } + }, + "gulp-yaml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gulp-yaml/-/gulp-yaml-1.0.1.tgz", + "integrity": "sha1-AIHJMhOCe66xJzD5P97on9a+Ey0=", + "dev": true, + "requires": { + "bufferstreams": "1.1.0", + "gulp-util": "3.0.7", + "js-yaml": "3.10.0", + "through2": "2.0.1", + "xtend": "4.0.1" + } + }, + "gulplog": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", + "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", + "dev": true, + "requires": { + "glogg": "1.0.0" + } + }, + "handle-thing": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", + "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=", + "dev": true + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "commander": "2.9.0", + "is-my-json-valid": "2.15.0", + "pinkie-promise": "2.0.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + } + }, + "has-binary": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", + "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "dev": true, + "requires": { + "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "dev": true + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-gulplog": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", + "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", + "dev": true, + "requires": { + "sparkles": "1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "hash.js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz", + "integrity": "sha1-EzL/ABVsCg/92CNgE9B7d6BFFXM=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "he": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.0.tgz", + "integrity": "sha1-KTGdSb7sE6mx88T5sqbd5IWbsqc=", + "dev": true + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "home-path": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.5.tgz", + "integrity": "sha1-eIspgVsS1Tus9XVkhHbm+QQdEz8=", + "dev": true + }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "dev": true, + "requires": { + "parse-passwd": "1.0.0" + } + }, + "hosted-git-info": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.5.tgz", + "integrity": "sha1-C6gdkNouJas0ozLm7HeTbhWYEYs=", + "dev": true + }, + "hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "obuf": "1.1.1", + "readable-stream": "2.1.5", + "wbuf": "1.7.2" + } + }, + "html-loader": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/html-loader/-/html-loader-0.4.4.tgz", + "integrity": "sha1-8rW5rNXgNf86tf02nBPJenuwFNo=", + "dev": true, + "requires": { + "es6-templates": "0.2.3", + "fastparse": "1.1.1", + "html-minifier": "3.2.3", + "loader-utils": "0.2.16", + "object-assign": "4.1.0" + } + }, + "html-minifier": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.2.3.tgz", + "integrity": "sha1-0v9TbiTZVybDMkk9j3fYTb7YU3I=", + "dev": true, + "requires": { + "camel-case": "3.0.0", + "clean-css": "3.4.21", + "commander": "2.9.0", + "he": "1.1.0", + "ncname": "1.0.0", + "param-case": "2.1.0", + "relateurl": "0.2.7", + "uglify-js": "2.7.4" + } + }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "http-errors": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.5.1.tgz", + "integrity": "sha1-eIwNLB3iyBuebowBhDtrl+uSB1A=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "setprototypeof": "1.0.2", + "statuses": "1.3.1" + } + }, + "http-proxy": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.16.2.tgz", + "integrity": "sha1-Bt/ykpUr9k2+hHH6nfcwZtTzd0I=", + "dev": true, + "requires": { + "eventemitter3": "1.2.0", + "requires-port": "1.0.0" + } + }, + "http-proxy-middleware": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.17.3.tgz", + "integrity": "sha1-lAOCFHFJuFYIT1U0dS1bWoFozR0=", + "dev": true, + "requires": { + "http-proxy": "1.16.2", + "is-glob": "3.1.0", + "lodash": "4.17.4", + "micromatch": "2.3.11" + }, + "dependencies": { + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + } + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.3.1", + "sshpk": "1.10.1" + } + }, + "https-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz", + "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", + "dev": true + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs=", + "dev": true + }, + "ieee754": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", + "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=", + "dev": true + }, + "ignore": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", + "integrity": "sha1-xOcVRV9gc6jX5drnLS/J1xZj26Y=", + "dev": true + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "in-publish": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz", + "integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "dev": true + }, + "inquirer": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", + "dev": true, + "requires": { + "ansi-escapes": "1.4.0", + "ansi-regex": "2.0.0", + "chalk": "1.1.3", + "cli-cursor": "1.0.2", + "cli-width": "2.2.0", + "figures": "1.7.0", + "lodash": "4.16.6", + "readline2": "1.0.1", + "run-async": "0.1.0", + "rx-lite": "3.1.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "through": "2.3.8" + } + }, + "interpret": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.1.tgz", + "integrity": "sha1-1Xn7f2k7hYAElHrzn6DbSfeVYCw=", + "dev": true + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true, + "requires": { + "loose-envify": "1.3.1" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "ipaddr.js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.2.0.tgz", + "integrity": "sha1-irpJyRknmVhb3WQ+DMtQ6K53e6Q=", + "dev": true + }, + "is": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is/-/is-0.3.0.tgz", + "integrity": "sha1-qPcd/IpuKDcWJ/JskpCYxvTV1dc=", + "dev": true + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=", + "dev": true, + "requires": { + "is-relative": "1.0.0", + "is-windows": "1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha1-FpwvbT3x+ZJhgHI2XJsOofaHhlY=", + "dev": true, + "requires": { + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "1.8.0" + } + }, + "is-buffer": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.4.tgz", + "integrity": "sha1-z8hszV3FpS+oBIkRHGkgxFfi2Ys=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha1-2Eh2Mh0Oet0DmQQGq7u9NrqSaMc=", + "dev": true, + "requires": { + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha1-OxWXRqZmBLBPjIFSS6NlxfFNhuw=", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "is-dotfile": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.2.tgz", + "integrity": "sha1-LBMjg/ORmfjtwmjKAbmwB9IFzE0=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-my-json-valid": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz", + "integrity": "sha1-k27do8o8IR/ZjzstPgjaQ/eykVs=", + "dev": true, + "requires": { + "generate-function": "2.0.0", + "generate-object-property": "1.2.0", + "jsonpointer": "4.0.0", + "xtend": "4.0.1" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "3.0.4" + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-odd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", + "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", + "dev": true, + "requires": { + "is-number": "3.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.0.4" + } + } + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "dev": true, + "requires": { + "is-path-inside": "1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=", + "dev": true, + "requires": { + "is-unc-path": "1.0.0" + } + }, + "is-resolvable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", + "dev": true, + "requires": { + "tryit": "1.0.3" + } + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=", + "dev": true, + "requires": { + "unc-path-regex": "0.1.2" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", + "integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.2.tgz", + "integrity": "sha1-Sj6XTsDLqQBNP8bN5yCeppNopiE=", + "dev": true + }, + "isexe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-1.1.2.tgz", + "integrity": "sha1-NvPiLmB1CSD15yQaR2qMakInWtA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "jasmine": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.9.0.tgz", + "integrity": "sha1-dlcfklyHg0CefGFTVy5aY0HPk+s=", + "dev": true, + "requires": { + "exit": "0.1.2", + "glob": "7.1.1", + "jasmine-core": "2.9.1" + } + }, + "jasmine-core": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.9.1.tgz", + "integrity": "sha1-trvB2OZSUNVvWIhGFwXr7uuI8i8=", + "dev": true + }, + "jasmine-spec-reporter": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", + "integrity": "sha1-HWMq7ANBZwrTJPkrqEtLMrNeniI=", + "dev": true, + "requires": { + "colors": "1.1.2" + } + }, + "jasmine-terminal-reporter": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/jasmine-terminal-reporter/-/jasmine-terminal-reporter-1.0.3.tgz", + "integrity": "sha1-iW8eyP30v2rs3UHFA+2nNH9hUms=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "pluralize": "1.2.1" + } + }, + "jodid25519": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", + "integrity": "sha1-BtSRIlUJNBlHfUJWM2BuDpB4KWc=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.0" + } + }, + "js-base64": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.3.tgz", + "integrity": "sha512-H7ErYLM34CvDMto3GbD6xD0JLUGYXR3QTcH6B/tr4Hi/QpSThnCsIp+Sy5FRTw3B0d6py4HcNkW7nO/wdtGWEw==", + "dev": true + }, + "js-tokens": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", + "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=", + "dev": true + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + } + } + }, + "jsbn": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz", + "integrity": "sha1-ZQmH2g3XT06/WhE3eiqi0nPpff0=", + "dev": true, + "optional": true + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json-loader": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", + "integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.0.tgz", + "integrity": "sha1-myBxWwJsvjd4/Xae3M2CLYMypbI=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "4.1.10" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsonpointer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.0.tgz", + "integrity": "sha1-ZmHhYdL8RF8Z+YQwIxNDci4fy9U=", + "dev": true + }, + "jsprim": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.3.1.tgz", + "integrity": "sha1-KnJW9wQSop7jZwqspiWZTE3P8lI=", + "dev": true, + "requires": { + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + } + }, + "karma": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz", + "integrity": "sha1-hcwI6eCiLXzpzKN8ShvoJPaisa4=", + "dev": true, + "requires": { + "bluebird": "3.5.1", + "body-parser": "1.18.2", + "chokidar": "1.6.1", + "colors": "1.1.2", + "combine-lists": "1.0.1", + "connect": "3.6.5", + "core-js": "2.4.1", + "di": "0.0.1", + "dom-serialize": "2.2.1", + "expand-braces": "0.1.2", + "glob": "7.1.1", + "graceful-fs": "4.1.10", + "http-proxy": "1.16.2", + "isbinaryfile": "3.0.2", + "lodash": "3.10.1", + "log4js": "0.6.38", + "mime": "1.3.4", + "minimatch": "3.0.3", + "optimist": "0.6.1", + "qjobs": "1.1.5", + "range-parser": "1.2.0", + "rimraf": "2.6.2", + "safe-buffer": "5.1.1", + "socket.io": "1.7.3", + "source-map": "0.5.6", + "tmp": "0.0.31", + "useragent": "2.3.0" + }, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=", + "dev": true, + "requires": { + "glob": "7.1.1" + } + } + } + }, + "karma-chrome-launcher": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", + "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", + "dev": true, + "requires": { + "fs-access": "1.0.1", + "which": "1.2.11" + } + }, + "karma-firefox-launcher": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-1.1.0.tgz", + "integrity": "sha1-LEcDBFLwRTHrfRPU/HZpYwu5Mzk=", + "dev": true + }, + "karma-jasmine": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-1.1.1.tgz", + "integrity": "sha1-b+hA51oRYAydkehLM8RY4cRqNSk=", + "dev": true + }, + "karma-sourcemap-loader": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.7.tgz", + "integrity": "sha1-kTIsd/jxPUb+0GKwQuEAnUxFBdg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10" + } + }, + "karma-webpack": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-2.0.9.tgz", + "integrity": "sha1-YciAkffdkQY1E0wDKyZqRlr/tX8=", + "dev": true, + "requires": { + "async": "0.9.2", + "loader-utils": "0.2.16", + "lodash": "3.10.1", + "source-map": "0.5.6", + "webpack-dev-middleware": "1.12.2" + }, + "dependencies": { + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "dev": true + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "time-stamp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.0.tgz", + "integrity": "sha1-lcakRTDhW6jW9KPsuMOj+sRto1c=", + "dev": true + }, + "webpack-dev-middleware": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz", + "integrity": "sha512-FCrqPy1yy/sN6U/SaEZcHKRXGlqU0DUaEBL45jkUYoB8foVb6wCnbIJ1HKIx+qUFTW+3JpVcCJCxZ8VATL4e+A==", + "dev": true, + "requires": { + "memory-fs": "0.4.1", + "mime": "1.6.0", + "path-is-absolute": "1.0.1", + "range-parser": "1.2.0", + "time-stamp": "2.0.0" + } + } + } + }, + "keypress": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz", + "integrity": "sha1-SjGI1CkbZrT2XtuZ+AaqmuKTWSo=", + "dev": true + }, + "kind-of": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.0.4.tgz", + "integrity": "sha1-e47PGKThf4Jp1ztQHJ8jLJaIenQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.4" + } + }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10" + } + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "4.0.1" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "1.0.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "liftoff": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", + "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", + "dev": true, + "requires": { + "extend": "3.0.0", + "findup-sync": "2.0.0", + "fined": "1.1.0", + "flagged-respawn": "1.0.0", + "is-plain-object": "2.0.4", + "object.map": "1.0.1", + "rechoir": "0.6.2", + "resolve": "1.4.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + } + }, + "loader-runner": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", + "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", + "dev": true + }, + "loader-utils": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.16.tgz", + "integrity": "sha1-8IYyBm7YKCg13/iN+1JwR2Wt7m0=", + "dev": true, + "requires": { + "big.js": "3.1.3", + "emojis-list": "2.1.0", + "json5": "0.5.0", + "object-assign": "4.1.0" + } + }, + "lodash": { + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.6.tgz", + "integrity": "sha1-0iyaxmAojzhD4Wun0rXQbMon13c=", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basetostring": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", + "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", + "dev": true + }, + "lodash._basevalues": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", + "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", + "dev": true + }, + "lodash._bindcallback": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", + "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", + "dev": true + }, + "lodash._createassigner": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz", + "integrity": "sha1-g4pbri/aymOsIt7o4Z+k5taXCxE=", + "dev": true, + "requires": { + "lodash._bindcallback": "3.0.1", + "lodash._isiterateecall": "3.0.9", + "lodash.restparam": "3.6.1" + } + }, + "lodash._escapehtmlchar": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._escapehtmlchar/-/lodash._escapehtmlchar-2.4.1.tgz", + "integrity": "sha1-32fDu2t+jh6DGrSL+geVuSr+iZ0=", + "dev": true, + "requires": { + "lodash._htmlescapes": "2.4.1" + } + }, + "lodash._escapestringchar": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._escapestringchar/-/lodash._escapestringchar-2.4.1.tgz", + "integrity": "sha1-7P4iYYoq3lC/7qQ5N+Ud9m8O23I=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._htmlescapes": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._htmlescapes/-/lodash._htmlescapes-2.4.1.tgz", + "integrity": "sha1-MtFL8IRLbeb4tioFG09nwii2JMs=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash._isnative": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._isnative/-/lodash._isnative-2.4.1.tgz", + "integrity": "sha1-PqZAS3hKe+g2x7V1gOHN95sUgyw=", + "dev": true + }, + "lodash._objecttypes": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._objecttypes/-/lodash._objecttypes-2.4.1.tgz", + "integrity": "sha1-fAt/admKH3ZSn4kLDNsbTf7BHBE=", + "dev": true + }, + "lodash._reescape": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", + "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", + "dev": true + }, + "lodash._reevaluate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", + "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash._reunescapedhtml": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._reunescapedhtml/-/lodash._reunescapedhtml-2.4.1.tgz", + "integrity": "sha1-dHxPxAED6zu4oJduVx96JlnpO6c=", + "dev": true, + "requires": { + "lodash._htmlescapes": "2.4.1", + "lodash.keys": "2.4.1" + }, + "dependencies": { + "lodash.keys": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", + "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", + "dev": true, + "requires": { + "lodash._isnative": "2.4.1", + "lodash._shimkeys": "2.4.1", + "lodash.isobject": "2.4.1" + } + } + } + }, + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", + "dev": true + }, + "lodash._shimkeys": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash._shimkeys/-/lodash._shimkeys-2.4.1.tgz", + "integrity": "sha1-bpzJZm/wgfC1psl4uD4kLmlJ0gM=", + "dev": true, + "requires": { + "lodash._objecttypes": "2.4.1" + } + }, + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", + "dev": true + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.defaults": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-2.4.1.tgz", + "integrity": "sha1-p+iIXwXmiFEUS24SqPNngCa8TFQ=", + "dev": true, + "requires": { + "lodash._objecttypes": "2.4.1", + "lodash.keys": "2.4.1" + }, + "dependencies": { + "lodash.keys": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", + "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", + "dev": true, + "requires": { + "lodash._isnative": "2.4.1", + "lodash._shimkeys": "2.4.1", + "lodash.isobject": "2.4.1" + } + } + } + }, + "lodash.escape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", + "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "dev": true, + "requires": { + "lodash._root": "3.0.1" + } + }, + "lodash.groupby": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.groupby/-/lodash.groupby-4.6.0.tgz", + "integrity": "sha1-Cwih3PaDl8OXhVwyOXg4Mt90A9E=", + "dev": true + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.isobject": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-2.4.1.tgz", + "integrity": "sha1-Wi5H/mmVPx7mMafrof5k0tBlWPU=", + "dev": true, + "requires": { + "lodash._objecttypes": "2.4.1" + } + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "lodash.mergewith": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.0.tgz", + "integrity": "sha1-FQzwoWeR9ZA7iJHqsVRgknS96lU=", + "dev": true + }, + "lodash.restparam": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", + "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", + "dev": true + }, + "lodash.template": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", + "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash._basetostring": "3.0.1", + "lodash._basevalues": "3.0.0", + "lodash._isiterateecall": "3.0.9", + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0", + "lodash.keys": "3.1.2", + "lodash.restparam": "3.6.1", + "lodash.templatesettings": "3.1.1" + } + }, + "lodash.templatesettings": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", + "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "dev": true, + "requires": { + "lodash._reinterpolate": "3.0.0", + "lodash.escape": "3.2.0" + } + }, + "lodash.values": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.values/-/lodash.values-2.4.1.tgz", + "integrity": "sha1-q/UUQ2s8twUAFieXjLzzCxKA7qQ=", + "dev": true, + "requires": { + "lodash.keys": "2.4.1" + }, + "dependencies": { + "lodash.keys": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-2.4.1.tgz", + "integrity": "sha1-SN6kbfj/djKxDXBrissmWR4rNyc=", + "dev": true, + "requires": { + "lodash._isnative": "2.4.1", + "lodash._shimkeys": "2.4.1", + "lodash.isobject": "2.4.1" + } + } + } + }, + "log4js": { + "version": "0.6.38", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", + "integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "semver": "4.3.6" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "dev": true + } + } + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "3.0.1" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.1" + } + }, + "lower-case": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.3.tgz", + "integrity": "sha1-ySOT2XZ5Pu5bpO21g8+OrjW9m/s=", + "dev": true + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "lru-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.1.tgz", + "integrity": "sha1-E0OVXtry432bnn7nJB4nxLn7cr4=", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.0.0" + } + }, + "make-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", + "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "make-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.0.tgz", + "integrity": "sha1-V7713IXSOSO6I3ZzJNjo+PPZaUs=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "1.0.1" + } + }, + "material-design-lite": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/material-design-lite/-/material-design-lite-1.3.0.tgz", + "integrity": "sha1-0ATOP+6Zoe63Sni4oyUTSl8RcdM=" + }, + "md5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", + "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", + "dev": true, + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "1.1.4" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "0.1.4", + "readable-stream": "2.1.5" + } + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.3.5", + "object-assign": "4.1.0", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" + } + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "merge-stream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", + "dev": true, + "requires": { + "readable-stream": "2.1.5" + } + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, + "mg-crud": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/mg-crud/-/mg-crud-1.1.2.tgz", + "integrity": "sha1-p6AWGzWSPK7/8ZpIBpS2V1vDggw=", + "requires": { + "angular": "1.6.8" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.0", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.0.4", + "normalize-path": "2.0.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.3" + } + }, + "miller-rabin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.0.tgz", + "integrity": "sha1-SmL7HUKTPAVYOYL0xxb2+55sbT0=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "brorand": "1.0.6" + } + }, + "mime": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", + "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=", + "dev": true + }, + "mime-db": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.24.0.tgz", + "integrity": "sha1-4tE/k58AFsbk6a0lqGUvEmxGfww=", + "dev": true + }, + "mime-types": { + "version": "2.1.12", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.12.tgz", + "integrity": "sha1-FSuiVndwIN1GY/VMLnvCY4HnFyk=", + "dev": true, + "requires": { + "mime-db": "1.24.0" + } + }, + "minimalistic-assert": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=", + "dev": true + }, + "minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q=", + "dev": true, + "requires": { + "brace-expansion": "1.1.6" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "minstache": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minstache/-/minstache-1.2.0.tgz", + "integrity": "sha1-/xzEA6woRPaNvxjGYhKb5+sO/EE=", + "dev": true, + "requires": { + "commander": "1.0.4" + }, + "dependencies": { + "commander": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz", + "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", + "dev": true, + "requires": { + "keypress": "0.1.0" + } + } + } + }, + "mixin-deep": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.0.tgz", + "integrity": "sha1-R6hzK6l3mUV8jB7KKPlRMtfoFQo=", + "dev": true, + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "dev": true + }, + "multipipe": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", + "dev": true, + "requires": { + "duplexer2": "0.0.2" + } + }, + "mustache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-2.3.0.tgz", + "integrity": "sha1-QCj3d4sXcIpImTCm5SrDvKDaQdA=", + "dev": true + }, + "mute-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", + "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", + "dev": true + }, + "mysql": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.15.0.tgz", + "integrity": "sha1-6haEEVY0Po8uR/yJhexBzdlXO1w=", + "dev": true, + "requires": { + "bignumber.js": "4.0.4", + "readable-stream": "2.3.3", + "safe-buffer": "5.1.1", + "sqlstring": "2.3.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + } + } + }, + "nan": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", + "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", + "dev": true + }, + "nanomatch": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.7.tgz", + "integrity": "sha1-U81KoQn/aLf4aVkf3J0Q2u7qPnk=", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "1.0.0", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "is-odd": "1.0.0", + "kind-of": "5.1.0", + "object.pick": "1.3.0", + "regex-not": "1.0.0", + "snapdragon": "0.8.1", + "to-regex": "3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + } + } + }, + "natives": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz", + "integrity": "sha1-ARrM4ffL2H97prMJPWzZOSvhxXQ=", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "ncname": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ncname/-/ncname-1.0.0.tgz", + "integrity": "sha1-W1etGLHKCShk72Kwse2BlPODtxw=", + "dev": true, + "requires": { + "xml-char-classes": "1.0.0" + } + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "dev": true + }, + "nightmare": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nightmare/-/nightmare-2.10.0.tgz", + "integrity": "sha1-6cXVkLspb1loX9SCGML7rER2eyE=", + "dev": true, + "requires": { + "debug": "2.2.0", + "deep-defaults": "1.0.4", + "defaults": "1.0.3", + "electron": "1.7.9", + "enqueue": "1.0.2", + "function-source": "0.1.0", + "jsesc": "0.5.0", + "minstache": "1.2.0", + "mkdirp": "0.5.1", + "once": "1.4.0", + "rimraf": "2.5.4", + "sliced": "1.0.1", + "split2": "2.2.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "no-case": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.0.tgz", + "integrity": "sha1-yiglzLdrGOb3nVc9z78erOM90WQ=", + "dev": true, + "requires": { + "lower-case": "1.1.3" + } + }, + "node-gyp": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.6.2.tgz", + "integrity": "sha1-m/vlRWIoYoSDjnUOrAUpWFP6HGA=", + "dev": true, + "requires": { + "fstream": "1.0.11", + "glob": "7.1.1", + "graceful-fs": "4.1.10", + "minimatch": "3.0.3", + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "npmlog": "4.1.2", + "osenv": "0.1.4", + "request": "2.77.0", + "rimraf": "2.5.4", + "semver": "5.3.0", + "tar": "2.2.1", + "which": "1.2.11" + } + }, + "node-libs-browser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.0.0.tgz", + "integrity": "sha1-o6WeyXAkmFtG6Vg3lkb5bEthZkY=", + "dev": true, + "requires": { + "assert": "1.4.1", + "browserify-zlib": "0.1.4", + "buffer": "4.9.1", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.11.0", + "domain-browser": "1.1.7", + "events": "1.1.1", + "https-browserify": "0.0.1", + "os-browserify": "0.2.1", + "path-browserify": "0.0.0", + "process": "0.11.9", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "readable-stream": "2.1.5", + "stream-browserify": "2.0.1", + "stream-http": "2.6.3", + "string_decoder": "0.10.31", + "timers-browserify": "2.0.2", + "tty-browserify": "0.0.0", + "url": "0.11.0", + "util": "0.10.3", + "vm-browserify": "0.0.4" + } + }, + "node-sass": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.7.2.tgz", + "integrity": "sha512-CaV+wLqZ7//Jdom5aUFCpGNoECd7BbNhjuwdsX/LkXBrHl8eb1Wjw4HvWqcFvhr5KuNgAk8i/myf/MQ1YYeroA==", + "dev": true, + "requires": { + "async-foreach": "0.1.3", + "chalk": "1.1.3", + "cross-spawn": "3.0.1", + "gaze": "1.1.2", + "get-stdin": "4.0.1", + "glob": "7.1.1", + "in-publish": "2.0.0", + "lodash.assign": "4.2.0", + "lodash.clonedeep": "4.5.0", + "lodash.mergewith": "4.6.0", + "meow": "3.7.0", + "mkdirp": "0.5.1", + "nan": "2.8.0", + "node-gyp": "3.6.2", + "npmlog": "4.1.2", + "request": "2.79.0", + "sass-graph": "2.2.4", + "stdout-stream": "1.4.0", + "true-case-path": "1.0.2" + }, + "dependencies": { + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "dev": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.5.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.0", + "forever-agent": "0.6.1", + "form-data": "2.1.1", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.12", + "oauth-sign": "0.8.2", + "qs": "6.3.0", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.4.3", + "uuid": "3.2.1" + } + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "dev": true + } + } + }, + "node-uuid": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", + "integrity": "sha1-baWhdmjEs91ZYjvaEc9/pMH2Cm8=", + "dev": true + }, + "node.extend": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.0.10.tgz", + "integrity": "sha1-Mmm934HFRTX0CKvHhMMrDSvVX28=", + "dev": true, + "requires": { + "is": "0.3.0" + } + }, + "nodemon": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.12.1.tgz", + "integrity": "sha1-mWpW3EnZ8Wu/G3ik3gjxNjSzh40=", + "dev": true, + "requires": { + "chokidar": "1.7.0", + "debug": "2.6.9", + "es6-promise": "3.3.1", + "ignore-by-default": "1.0.1", + "lodash.defaults": "3.1.2", + "minimatch": "3.0.4", + "ps-tree": "1.1.0", + "touch": "3.1.0", + "undefsafe": "0.0.3", + "update-notifier": "2.2.0" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "1.3.0", + "async-each": "1.0.1", + "fsevents": "1.1.3", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", + "dev": true + }, + "lodash.assign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-3.2.0.tgz", + "integrity": "sha1-POnwI0tLIiPilrj6CsH+6OvKZPo=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._createassigner": "3.1.1", + "lodash.keys": "3.1.2" + } + }, + "lodash.defaults": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-3.1.2.tgz", + "integrity": "sha1-xzCLGNv4vJNy1wGnNJPGEZK9Liw=", + "dev": true, + "requires": { + "lodash.assign": "3.2.0", + "lodash.restparam": "3.6.1" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1.0.9" + } + }, + "normalize-package-data": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz", + "integrity": "sha1-jZJPFClg4Xd+f/4XBUNjHMfLAt8=", + "dev": true, + "requires": { + "hosted-git-info": "2.1.5", + "is-builtin-module": "1.0.0", + "semver": "5.3.0", + "validate-npm-package-license": "3.0.1" + } + }, + "normalize-path": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.0.1.tgz", + "integrity": "sha1-R4hqwWYnYNQmG32XnSQXCdPOP3o=", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "nugget": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nugget/-/nugget-2.0.1.tgz", + "integrity": "sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA=", + "dev": true, + "requires": { + "debug": "2.2.0", + "minimist": "1.2.0", + "pretty-bytes": "1.0.4", + "progress-stream": "1.2.0", + "request": "2.77.0", + "single-line-log": "1.1.2", + "throttleit": "0.0.2" + } + }, + "null-check": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", + "integrity": "sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "object-assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "dev": true + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.0.4" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.0.4" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.0.4" + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + } + } + } + } + }, + "object-keys": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", + "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "object.defaults": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", + "dev": true, + "requires": { + "array-each": "1.0.1", + "array-slice": "1.1.0", + "for-own": "1.0.0", + "isobject": "3.0.1" + }, + "dependencies": { + "array-slice": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "object.map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", + "dev": true, + "requires": { + "for-own": "1.0.0", + "make-iterator": "1.0.0" + }, + "dependencies": { + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + } + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "0.1.4", + "is-extendable": "0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "obuf": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.1.tgz", + "integrity": "sha1-EEEktsYCxnlogaBCVB0220OlJk4=", + "dev": true + }, + "oclazyload": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/oclazyload/-/oclazyload-0.6.3.tgz", + "integrity": "sha1-Kjirv/QJDAihEBZxkZRbWfLoJ5w=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", + "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "opn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/opn/-/opn-4.0.2.tgz", + "integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=", + "dev": true, + "requires": { + "object-assign": "4.1.0", + "pinkie-promise": "2.0.1" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + }, + "dependencies": { + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, + "options": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", + "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", + "dev": true + }, + "orchestrator": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", + "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", + "dev": true, + "requires": { + "end-of-stream": "0.1.5", + "sequencify": "0.0.7", + "stream-consume": "0.1.0" + } + }, + "ordered-read-streams": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", + "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", + "dev": true + }, + "original": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/original/-/original-1.0.0.tgz", + "integrity": "sha1-kUf5P6FpbQS+YeAb1QuurKZWvTs=", + "dev": true, + "requires": { + "url-parse": "1.0.5" + }, + "dependencies": { + "url-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.0.5.tgz", + "integrity": "sha1-CFSGBCKv3P7+tsllxmLUgAFpkns=", + "dev": true, + "requires": { + "querystringify": "0.0.4", + "requires-port": "1.0.0" + } + } + } + }, + "os-browserify": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.2.1.tgz", + "integrity": "sha1-Y/xMzuXS13Y9Jrv4YBB45sLgBE8=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-queue": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-1.2.0.tgz", + "integrity": "sha1-Y5y4sHJwwVtx16ZEao4wQU88ltE=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "6.7.1", + "registry-auth-token": "3.3.1", + "registry-url": "3.1.0", + "semver": "5.3.0" + } + }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", + "dev": true + }, + "param-case": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.0.tgz", + "integrity": "sha1-Jhn5D9bIKe0LlY8chO0Dp0Wm1wo=", + "dev": true, + "requires": { + "no-case": "2.3.0" + } + }, + "parse-asn1": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.0.0.tgz", + "integrity": "sha1-NQYPbVAV03Yox3D04JGgtaJ4vCM=", + "dev": true, + "requires": { + "asn1.js": "4.9.1", + "browserify-aes": "1.0.6", + "create-hash": "1.1.2", + "evp_bytestokey": "1.0.0", + "pbkdf2": "3.0.9" + } + }, + "parse-filepath": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", + "dev": true, + "requires": { + "is-absolute": "1.0.0", + "map-cache": "0.2.2", + "path-root": "0.1.1" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.2", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.0" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "parsejson": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz", + "integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=", + "dev": true, + "requires": { + "better-assert": "1.0.2" + } + }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dev": true, + "requires": { + "better-assert": "1.0.2" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dev": true, + "requires": { + "better-assert": "1.0.2" + } + }, + "parseurl": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.1.tgz", + "integrity": "sha1-yKuMkiO6NIiKpkopeyiFO+wY2lY=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-root": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", + "dev": true, + "requires": { + "path-root-regex": "0.1.2" + } + }, + "path-root-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "pbkdf2": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.9.tgz", + "integrity": "sha1-8sSyWmAAWLPDdzwIbDfbvuH/5pM=", + "dev": true, + "requires": { + "create-hmac": "1.1.4" + } + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "pkg-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", + "dev": true, + "requires": { + "find-up": "1.1.2" + } + }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" + }, + "dependencies": { + "arr-diff": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "1.0.1", + "array-slice": "0.2.3" + } + } + } + }, + "pluralize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "dev": true + }, + "portfinder": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.13.tgz", + "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", + "dev": true, + "requires": { + "async": "1.5.2", + "debug": "2.2.0", + "mkdirp": "0.5.1" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + } + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "pretty-bytes": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", + "dev": true, + "requires": { + "get-stdin": "4.0.1", + "meow": "3.7.0" + } + }, + "pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", + "dev": true + }, + "private": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz", + "integrity": "sha1-VcapdtD5uvuZJIUTUP5HubX7t8E=", + "dev": true + }, + "process": { + "version": "0.11.9", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.9.tgz", + "integrity": "sha1-e9WtIapiU+fahoImTx4R0RwDGME=", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "progress": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, + "progress-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-1.2.0.tgz", + "integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=", + "dev": true, + "requires": { + "speedometer": "0.1.4", + "through2": "0.2.3" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "through2": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", + "dev": true, + "requires": { + "readable-stream": "1.1.14", + "xtend": "2.1.2" + } + }, + "xtend": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", + "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", + "dev": true, + "requires": { + "object-keys": "0.4.0" + } + } + } + }, + "proxy-addr": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.3.tgz", + "integrity": "sha1-3JdQL1ci6IhGez+iKXp7H/R98HQ=", + "dev": true, + "requires": { + "forwarded": "0.1.0", + "ipaddr.js": "1.2.0" + } + }, + "prr": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", + "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=", + "dev": true + }, + "ps-tree": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz", + "integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=", + "dev": true, + "requires": { + "event-stream": "3.3.4" + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.0.tgz", + "integrity": "sha1-OfaZ86RlYN1eusvKaTyvfGXBjMY=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "browserify-rsa": "4.0.1", + "create-hash": "1.1.2", + "parse-asn1": "5.0.0", + "randombytes": "2.0.3" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qjobs": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.1.5.tgz", + "integrity": "sha1-ZZ3p8s+NzCehSBJ28gU3cnI4LnM=", + "dev": true + }, + "qs": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.0.tgz", + "integrity": "sha1-9AOyZPI7wBIox0ExtAfxjV6l1EI=", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "querystringify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-0.0.4.tgz", + "integrity": "sha1-DPf4T5Rj/wrlHExLFC2VvjdyTZw=", + "dev": true + }, + "randomatic": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.6.tgz", + "integrity": "sha1-EQ3Kv/OX6dz/fAeJzMCkmt8exbs=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "kind-of": "3.0.4" + } + }, + "randombytes": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.3.tgz", + "integrity": "sha1-Z0yZdgkBw8QRJ3GjHlIdw0nMCew=", + "dev": true + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", + "dev": true + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", + "dev": true + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "dev": true, + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": "1.3.1" + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", + "dev": true + } + } + }, + "raw-loader": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz", + "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=", + "dev": true + }, + "rc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "dev": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.3.5", + "path-type": "1.1.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + } + }, + "readable-stream": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz", + "integrity": "sha1-ZvqLcg4UOLNkaB8q0aY8YYRIydA=", + "dev": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.10", + "minimatch": "3.0.3", + "readable-stream": "2.1.5", + "set-immediate-shim": "1.0.1" + } + }, + "readline2": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", + "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "mute-stream": "0.0.5" + } + }, + "recast": { + "version": "0.11.18", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.18.tgz", + "integrity": "sha1-B69iV8p2mGiBUglAHU1g7vG1uUc=", + "dev": true, + "requires": { + "ast-types": "0.9.2", + "esprima": "3.1.2", + "private": "0.1.6", + "source-map": "0.5.6" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "1.4.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "strip-indent": "1.0.1" + } + }, + "regenerate": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", + "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", + "dev": true + }, + "regenerator-runtime": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.1.tgz", + "integrity": "sha1-JX9BlhzkRVixj3gUr0jBdVn5+us=", + "dev": true + }, + "regenerator-transform": { + "version": "0.9.8", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.8.tgz", + "integrity": "sha1-D4i7K8A5Mt23trcxLmgHjwECbWw=", + "dev": true, + "requires": { + "babel-runtime": "6.22.0", + "babel-types": "6.22.0", + "private": "0.1.6" + } + }, + "regex-cache": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz", + "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3", + "is-primitive": "2.0.0" + } + }, + "regex-not": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", + "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "1.3.2", + "regjsgen": "0.2.0", + "regjsparser": "0.1.5" + } + }, + "registry-auth-token": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", + "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", + "dev": true, + "requires": { + "rc": "1.2.1", + "safe-buffer": "5.1.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "1.2.1" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "request": { + "version": "2.77.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.77.0.tgz", + "integrity": "sha1-KwDYIDDt7cyXCJ/6XYgQqcKqMUs=", + "dev": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.5.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.0", + "forever-agent": "0.6.1", + "form-data": "2.1.1", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.12", + "node-uuid": "1.4.7", + "oauth-sign": "0.8.2", + "qs": "6.3.0", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.4.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + } + }, + "require-yaml": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz", + "integrity": "sha1-LhsY2RPDuqcqWk03O28Tjd0sMr0=", + "requires": { + "js-yaml": "3.10.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + } + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha1-p1vgHFPaJdk0qY69DkxKcxL5KoY=", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dev": true, + "requires": { + "expand-tilde": "2.0.2", + "global-modules": "1.0.0" + } + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "1.1.1", + "onetime": "1.1.0" + } + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "requires": { + "align-text": "0.1.4" + } + }, + "rimraf": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.5.4.tgz", + "integrity": "sha1-loAAk8vxoMhr2VtGJUZ1NcKd+gQ=", + "dev": true, + "requires": { + "glob": "7.1.1" + } + }, + "ripemd160": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-1.0.1.tgz", + "integrity": "sha1-k6S71JQrxXS2mo+lfHHeEOzKfW4=", + "dev": true + }, + "run-async": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", + "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, + "run-sequence": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/run-sequence/-/run-sequence-2.2.0.tgz", + "integrity": "sha1-s/jUKDbbidCLL+cE6vDJPf2DNeI=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "gulp-util": "3.0.8" + }, + "dependencies": { + "dateformat": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", + "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", + "dev": true + }, + "gulp-util": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", + "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", + "dev": true, + "requires": { + "array-differ": "1.0.0", + "array-uniq": "1.0.3", + "beeper": "1.1.1", + "chalk": "1.1.3", + "dateformat": "2.2.0", + "fancy-log": "1.2.0", + "gulplog": "1.0.0", + "has-gulplog": "0.1.0", + "lodash._reescape": "3.0.0", + "lodash._reevaluate": "3.0.0", + "lodash._reinterpolate": "3.0.0", + "lodash.template": "3.6.2", + "minimist": "1.2.0", + "multipipe": "0.1.2", + "object-assign": "3.0.0", + "replace-ext": "0.0.1", + "through2": "2.0.1", + "vinyl": "0.5.3" + } + }, + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", + "dev": true + } + } + }, + "rx-lite": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", + "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", + "dev": true + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", + "dev": true + }, + "sass-graph": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz", + "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", + "dev": true, + "requires": { + "glob": "7.1.1", + "lodash": "4.16.6", + "scss-tokenizer": "0.2.3", + "yargs": "7.1.0" + } + }, + "sass-loader": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-4.1.1.tgz", + "integrity": "sha1-ee+UaM8L9kbClSnh8sumvW5Rx7w=", + "dev": true, + "requires": { + "async": "2.1.2", + "loader-utils": "0.2.16", + "object-assign": "4.1.0" + } + }, + "scss-tokenizer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", + "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", + "dev": true, + "requires": { + "js-base64": "2.4.3", + "source-map": "0.4.4" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + } + } + }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "5.3.0" + } + }, + "send": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.14.2.tgz", + "integrity": "sha1-ObBDiz9RC+Xcb2Z6EfcWiTaM3u8=", + "dev": true, + "requires": { + "debug": "2.2.0", + "depd": "1.1.0", + "destroy": "1.0.4", + "encodeurl": "1.0.1", + "escape-html": "1.0.3", + "etag": "1.7.0", + "fresh": "0.3.0", + "http-errors": "1.5.1", + "mime": "1.3.4", + "ms": "0.7.2", + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.3.1" + }, + "dependencies": { + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "sequencify": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", + "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", + "dev": true + }, + "serve-index": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.8.0.tgz", + "integrity": "sha1-fF2WwT+xMRAfk8HFd0+FFqHnjTs=", + "dev": true, + "requires": { + "accepts": "1.3.3", + "batch": "0.5.3", + "debug": "2.2.0", + "escape-html": "1.0.3", + "http-errors": "1.5.1", + "mime-types": "2.1.12", + "parseurl": "1.3.1" + } + }, + "serve-static": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.11.2.tgz", + "integrity": "sha1-LPmIm9RDWjIMw2iVyapXvWYuasc=", + "dev": true, + "requires": { + "encodeurl": "1.0.1", + "escape-html": "1.0.3", + "parseurl": "1.3.1", + "send": "0.14.2" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-getter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "dev": true, + "requires": { + "to-object-path": "0.3.0" + } + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "setprototypeof": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.2.tgz", + "integrity": "sha1-gaVSFB7BBLiOic44MQOtXGZWTQg=", + "dev": true + }, + "sha.js": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.8.tgz", + "integrity": "sha1-NwaMLEdra69ALRSknGf1l5IfY08=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "dev": true, + "requires": { + "glob": "7.1.1", + "interpret": "1.0.1", + "rechoir": "0.6.2" + } + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, + "signal-exit": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz", + "integrity": "sha1-WkyISZK2OnrNm623iUw+6c/MrYE=", + "dev": true + }, + "single-line-log": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz", + "integrity": "sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=", + "dev": true, + "requires": { + "string-width": "1.0.2" + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "sliced": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=", + "dev": true + }, + "snapdragon": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", + "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", + "dev": true, + "requires": { + "base": "0.11.2", + "debug": "2.2.0", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.6", + "source-map-resolve": "0.5.1", + "use": "2.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "dev": true, + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "socket.io": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.3.tgz", + "integrity": "sha1-uK+cq6AJSeVo42nxMn6pvp6iRhs=", + "dev": true, + "requires": { + "debug": "2.3.3", + "engine.io": "1.8.3", + "has-binary": "0.1.7", + "object-assign": "4.1.0", + "socket.io-adapter": "0.5.0", + "socket.io-client": "1.7.3", + "socket.io-parser": "2.3.1" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "socket.io-adapter": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz", + "integrity": "sha1-y21LuL7IHhB4uZZ3+c7QBGBmu4s=", + "dev": true, + "requires": { + "debug": "2.3.3", + "socket.io-parser": "2.3.1" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "socket.io-client": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.7.3.tgz", + "integrity": "sha1-sw6GqhDV7zVGYBwJzeR2Xjgdo3c=", + "dev": true, + "requires": { + "backo2": "1.0.2", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "2.3.3", + "engine.io-client": "1.8.3", + "has-binary": "0.1.7", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseuri": "0.0.5", + "socket.io-parser": "2.3.1", + "to-array": "0.1.4" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "socket.io-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz", + "integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=", + "dev": true, + "requires": { + "component-emitter": "1.1.2", + "debug": "2.2.0", + "isarray": "0.0.1", + "json3": "3.3.2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, + "sockjs": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.18.tgz", + "integrity": "sha1-2bKJMWyn33dZXvKZ4HXw+TfrQgc=", + "dev": true, + "requires": { + "faye-websocket": "0.10.0", + "uuid": "2.0.3" + } + }, + "sockjs-client": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.1.tgz", + "integrity": "sha1-KEhD6al4TXxHSxVxsyQPyp3aS7A=", + "dev": true, + "requires": { + "debug": "2.2.0", + "eventsource": "0.1.6", + "faye-websocket": "0.11.1", + "inherits": "2.0.3", + "json3": "3.3.2", + "url-parse": "1.1.7" + }, + "dependencies": { + "faye-websocket": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", + "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", + "dev": true, + "requires": { + "websocket-driver": "0.6.5" + } + } + } + }, + "source-list-map": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-0.1.8.tgz", + "integrity": "sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY=", + "dev": true + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", + "integrity": "sha1-etD1k/IoFZjoVN+A8ZquS5LXoRo=", + "dev": true, + "requires": { + "atob": "2.0.3", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" + } + }, + "source-map-support": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.11.tgz", + "integrity": "sha1-ZH+TmXizhTWQlTCIUwPa8jJ58yI=", + "dev": true, + "requires": { + "source-map": "0.5.6" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "sparkles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", + "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", + "dev": true + }, + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + }, + "spdy": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.4.tgz", + "integrity": "sha1-4EBkB8qQ/wG1U+sBNQVEJkn1qBk=", + "dev": true, + "requires": { + "debug": "2.2.0", + "handle-thing": "1.2.5", + "http-deceiver": "1.2.7", + "select-hose": "2.0.0", + "spdy-transport": "2.0.18" + } + }, + "spdy-transport": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.0.18.tgz", + "integrity": "sha1-Q/ycVr4szMErs+J1SqlxFU6DbqY=", + "dev": true, + "requires": { + "debug": "2.2.0", + "hpack.js": "2.1.6", + "obuf": "1.1.1", + "readable-stream": "2.1.5", + "wbuf": "1.7.2" + } + }, + "speedometer": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-0.1.4.tgz", + "integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=", + "dev": true + }, + "split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "dev": true, + "requires": { + "through": "2.3.8" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "dev": true, + "requires": { + "extend-shallow": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha1-p0cPnkJnM9gb2B4RVSZOOjUHyrQ=", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha1-GGsldbz4PoW30YRldWI47k7kJJM=", + "dev": true, + "requires": { + "through2": "2.0.3" + }, + "dependencies": { + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.1.5", + "xtend": "4.0.1" + } + } + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "sqlstring": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.0.tgz", + "integrity": "sha1-UluKT9Jtb3GqYegipsr5dtMa0qg=", + "dev": true + }, + "sshpk": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.10.1.tgz", + "integrity": "sha1-MOGl0ykkSXShr2FREznVla9mOLA=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.0", + "dashdash": "1.14.0", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.6", + "jodid25519": "1.0.2", + "jsbn": "0.1.0", + "tweetnacl": "0.14.3" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + } + } + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "dev": true + }, + "stdout-stream": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.0.tgz", + "integrity": "sha1-osfIWH5U2UJ+qe2zrD8s1SLfN4s=", + "dev": true, + "requires": { + "readable-stream": "2.1.5" + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.1.5" + } + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "dev": true, + "requires": { + "duplexer": "0.1.1" + } + }, + "stream-consume": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", + "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=", + "dev": true + }, + "stream-http": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.6.3.tgz", + "integrity": "sha1-TD3b+WNZaOos/U5I1D3l3vJiWsM=", + "dev": true, + "requires": { + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.1.5", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "style-loader": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.13.1.tgz", + "integrity": "sha1-RoKA77wEcwI806bNVuM7Wh1/w6k=", + "dev": true, + "requires": { + "loader-utils": "0.2.16" + }, + "dependencies": { + "loader-utils": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.16.tgz", + "integrity": "sha1-8IYyBm7YKCg13/iN+1JwR2Wt7m0=", + "dev": true, + "requires": { + "big.js": "3.1.3", + "emojis-list": "2.1.0", + "json5": "0.5.0", + "object-assign": "4.1.0" + }, + "dependencies": { + "big.js": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz", + "integrity": "sha1-TK2iGTZS6zyp7I5VyQFWacmAaXg=", + "dev": true + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "json5": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.0.tgz", + "integrity": "sha1-myBxWwJsvjd4/Xae3M2CLYMypbI=", + "dev": true + }, + "object-assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "dev": true + } + } + } + } + }, + "sumchecker": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-1.3.1.tgz", + "integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=", + "dev": true, + "requires": { + "debug": "2.2.0", + "es6-promise": "4.1.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "dev": true, + "requires": { + "ajv": "4.11.2", + "ajv-keywords": "1.5.1", + "chalk": "1.1.3", + "lodash": "4.16.6", + "slice-ansi": "0.0.4", + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "tapable": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.6.tgz", + "integrity": "sha1-IGvo4YiGC1FEJTdebxrom/sB/Y0=", + "dev": true + }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "dev": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "0.7.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "throttleit": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-0.0.2.tgz", + "integrity": "sha1-z+34jmDADdlpe2H90qg0OptoDq8=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.1.tgz", + "integrity": "sha1-OE51MU1J8y3hLuu4E2uOtrXVnak=", + "dev": true, + "requires": { + "readable-stream": "2.0.6", + "xtend": "4.0.1" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + } + } + }, + "tildify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", + "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", + "dev": true, + "requires": { + "os-homedir": "1.0.2" + } + }, + "time-stamp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.0.1.tgz", + "integrity": "sha1-n0vSNVnJNllm8zAtu6KwfGuZsVE=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "timers-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.2.tgz", + "integrity": "sha1-q0iDz1l9zVCvIRNJoA+8pWrIa4Y=", + "dev": true, + "requires": { + "setimmediate": "1.0.5" + } + }, + "tmp": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", + "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "dev": true + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.2.tgz", + "integrity": "sha1-8/XAw7pymafvmUJ+RGMyV63kMyA=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "3.0.4" + } + }, + "to-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", + "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "regex-not": "1.0.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.0.4" + } + } + } + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", + "dev": true, + "requires": { + "nopt": "1.0.10" + }, + "dependencies": { + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1.0.9" + } + } + } + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "true-case-path": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.2.tgz", + "integrity": "sha1-fskRMJJHZsf1c74wIMNPj9/QDWI=", + "dev": true, + "requires": { + "glob": "6.0.4" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "dev": true, + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.3", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "tryit": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", + "dev": true + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + }, + "tweetnacl": { + "version": "0.14.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.3.tgz", + "integrity": "sha1-PaOC9nDyXe1417PReSEZvKC3Ey0=", + "dev": true, + "optional": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, + "type-is": { + "version": "1.6.14", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.14.tgz", + "integrity": "sha1-4hljnBfe0coHiQkt1UoDgmuBfLI=", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "2.1.14" + }, + "dependencies": { + "mime-db": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.26.0.tgz", + "integrity": "sha1-6v/NDk/Gk1z4E02iRuLmw1MFrf8=", + "dev": true + }, + "mime-types": { + "version": "2.1.14", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.14.tgz", + "integrity": "sha1-9+99l1g/yvO30oK2+LVnnaselO4=", + "dev": true, + "requires": { + "mime-db": "1.26.0" + } + } + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "uglify-js": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.4.tgz", + "integrity": "sha1-opWg3hK2plDAMcQN6w3ECxRWi9I=", + "dev": true, + "requires": { + "async": "0.2.10", + "source-map": "0.5.6", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true + }, + "ultron": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", + "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=", + "dev": true + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true + }, + "undefsafe": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-0.0.3.tgz", + "integrity": "sha1-7Mo6A+VrmvFzhbqsgSrIO5lKli8=", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, + "dependencies": { + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } + } + } + }, + "unique-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", + "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", + "dev": true + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "1.0.0" + } + }, + "universalify": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", + "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "update-notifier": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.2.0.tgz", + "integrity": "sha1-G1g3z5DAc22IYncytmHBOPht5y8=", + "dev": true, + "requires": { + "boxen": "1.2.1", + "chalk": "1.1.3", + "configstore": "3.1.1", + "import-lazy": "2.1.0", + "is-npm": "1.0.0", + "latest-version": "3.1.0", + "semver-diff": "2.1.0", + "xdg-basedir": "3.0.0" + } + }, + "upper-case": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", + "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", + "dev": true + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-parse": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.1.7.tgz", + "integrity": "sha1-Alz/mZZTpFmrNCMhR9iVFMyH10o=", + "dev": true, + "requires": { + "querystringify": "0.0.4", + "requires-port": "1.0.0" + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "1.0.4" + } + }, + "use": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", + "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "isobject": "3.0.1", + "lazy-cache": "2.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha1-Nm2CQN3kh8pRgjsaufB6EKeCUco=", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha1-cpyR4thXt6QZofmqZWhcTDP1hF0=", + "dev": true + }, + "lazy-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "dev": true, + "requires": { + "set-getter": "0.1.0" + } + } + } + }, + "user-home": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", + "dev": true, + "requires": { + "os-homedir": "1.0.2" + } + }, + "useragent": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.3.0.tgz", + "integrity": "sha1-IX+UOtVAyyEoZYqyP8lg9qiMmXI=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "tmp": "0.0.31" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "utils-merge": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", + "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=", + "dev": true + }, + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", + "dev": true + }, + "v8flags": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", + "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "dev": true, + "requires": { + "user-home": "1.1.1" + }, + "dependencies": { + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + } + } + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "validator": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/validator/-/validator-6.2.1.tgz", + "integrity": "sha1-vFdbeNFb6y4zimZbqVMMf0Ce9mc=" + }, + "vary": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.0.tgz", + "integrity": "sha1-4eWv+70WrnaN0mdDlLmtMCJlMUA=", + "dev": true + }, + "verror": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", + "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", + "dev": true, + "requires": { + "extsprintf": "1.0.2" + } + }, + "vinyl": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", + "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", + "dev": true, + "requires": { + "clone": "1.0.2", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + } + }, + "vinyl-fs": { + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", + "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", + "dev": true, + "requires": { + "defaults": "1.0.3", + "glob-stream": "3.1.18", + "glob-watcher": "0.0.6", + "graceful-fs": "3.0.11", + "mkdirp": "0.5.1", + "strip-bom": "1.0.0", + "through2": "0.6.5", + "vinyl": "0.4.6" + }, + "dependencies": { + "clone": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", + "dev": true + }, + "graceful-fs": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", + "dev": true, + "requires": { + "natives": "1.1.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "strip-bom": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", + "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", + "dev": true, + "requires": { + "first-chunk-stream": "1.0.0", + "is-utf8": "0.2.1" + } + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": "1.0.34", + "xtend": "4.0.1" + } + }, + "vinyl": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", + "dev": true, + "requires": { + "clone": "0.2.0", + "clone-stats": "0.0.1" + } + } + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "dev": true + }, + "watchpack": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.2.0.tgz", + "integrity": "sha1-FdRiDx50cfE/y1UdXAMNLD60Lbs=", + "dev": true, + "requires": { + "async": "2.1.2", + "chokidar": "1.6.1", + "graceful-fs": "4.1.10" + } + }, + "wbuf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.2.tgz", + "integrity": "sha1-1pe5nx9ZUS3ydRvkJ2nBWAtYAf4=", + "dev": true, + "requires": { + "minimalistic-assert": "1.0.0" + } + }, + "webpack": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-2.2.1.tgz", + "integrity": "sha1-e7HXKuIIfdGkr1Jq/sFe7RfdpHU=", + "dev": true, + "requires": { + "acorn": "4.0.8", + "acorn-dynamic-import": "2.0.1", + "ajv": "4.11.2", + "ajv-keywords": "1.5.1", + "async": "2.1.2", + "enhanced-resolve": "3.0.3", + "interpret": "1.0.1", + "json-loader": "0.5.7", + "loader-runner": "2.3.0", + "loader-utils": "0.2.16", + "memory-fs": "0.4.1", + "mkdirp": "0.5.1", + "node-libs-browser": "2.0.0", + "source-map": "0.5.6", + "supports-color": "3.2.3", + "tapable": "0.2.6", + "uglify-js": "2.7.5", + "watchpack": "1.2.0", + "webpack-sources": "0.1.4", + "yargs": "6.6.0" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + } + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + }, + "uglify-js": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz", + "integrity": "sha1-RhLAx7qu4rp8SH3kkErhIgefLKg=", + "dev": true, + "requires": { + "async": "0.2.10", + "source-map": "0.5.6", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true + }, + "yargs": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", + "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", + "dev": true, + "requires": { + "camelcase": "3.0.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "1.4.0", + "read-pkg-up": "1.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "1.0.2", + "which-module": "1.0.0", + "y18n": "3.2.1", + "yargs-parser": "4.2.1" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.0.0" + } + } + } + }, + "yargs-parser": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "dev": true, + "requires": { + "camelcase": "3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } + } + } + }, + "webpack-dev-middleware": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.10.0.tgz", + "integrity": "sha1-fVviZR5pL936/Yqu0XfBb/UfDrg=", + "dev": true, + "requires": { + "memory-fs": "0.4.1", + "mime": "1.3.4", + "path-is-absolute": "1.0.1", + "range-parser": "1.2.0" + } + }, + "webpack-dev-server": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.2.1.tgz", + "integrity": "sha1-kcRCFhr+m1M04L8YabFDiA7Okvo=", + "dev": true, + "requires": { + "chokidar": "1.6.1", + "compression": "1.6.2", + "connect-history-api-fallback": "1.3.0", + "express": "4.14.1", + "http-proxy-middleware": "0.17.3", + "opn": "4.0.2", + "portfinder": "1.0.13", + "serve-index": "1.8.0", + "sockjs": "0.3.18", + "sockjs-client": "1.1.1", + "spdy": "3.4.4", + "strip-ansi": "3.0.1", + "supports-color": "3.2.3", + "webpack-dev-middleware": "1.10.0", + "yargs": "6.6.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + }, + "yargs": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", + "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", + "dev": true, + "requires": { + "camelcase": "3.0.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "1.4.0", + "read-pkg-up": "1.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "1.0.2", + "which-module": "1.0.0", + "y18n": "3.2.1", + "yargs-parser": "4.2.1" + } + }, + "yargs-parser": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "dev": true, + "requires": { + "camelcase": "3.0.0" + } + } + } + }, + "webpack-sources": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-0.1.4.tgz", + "integrity": "sha1-zMLIF+COX6OTI5QSaQu0gYITk80=", + "dev": true, + "requires": { + "source-list-map": "0.1.8", + "source-map": "0.5.6" + } + }, + "websocket-driver": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.6.5.tgz", + "integrity": "sha1-XLJVbOuF9Dc8bYI4qmkchFThOjY=", + "dev": true, + "requires": { + "websocket-extensions": "0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.1.tgz", + "integrity": "sha1-domUmcGEtu91Q3fC27DNbLVdKec=", + "dev": true + }, + "which": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/which/-/which-1.2.11.tgz", + "integrity": "sha1-yLLu6muMFln6fB3U/aq+lTPcXos=", + "dev": true, + "requires": { + "isexe": "1.1.2" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true + }, + "wide-align": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "dev": true, + "requires": { + "string-width": "1.0.2" + } + }, + "widest-line": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", + "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=", + "dev": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + }, + "wrap-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.0.0.tgz", + "integrity": "sha1-fTD4+HP5pbvDpk2ryNF34HGuQm8=", + "dev": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha1-H/YVdcLipOjlENb6TiQ8zhg5mas=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + } + } + }, + "ws": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.2.tgz", + "integrity": "sha1-iiRPoFJAHgjJiGz0SoUYnh/UBn8=", + "dev": true, + "requires": { + "options": "0.0.6", + "ultron": "1.0.2" + } + }, + "wtf-8": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz", + "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=", + "dev": true + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, + "xml-char-classes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/xml-char-classes/-/xml-char-classes-1.0.0.tgz", + "integrity": "sha1-ZGV4SKIP/F31g6Qq2KJ3tFErvE0=", + "dev": true + }, + "xmlhttprequest-ssl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz", + "integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.0.0.tgz", + "integrity": "sha1-MGxUODXwnuGkyyO3vOmrNByRzdQ=", + "dev": true + }, + "yaml-loader": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/yaml-loader/-/yaml-loader-0.5.0.tgz", + "integrity": "sha512-p9QIzcFSNm4mCw/m5NdyMfN4RE4aFZJWRRb01ERVNGCym8VNbKtw3OYZXnvUIkim6U/EjqE/2yIh9F/msShH9A==", + "dev": true, + "requires": { + "js-yaml": "3.10.0" + } + }, + "yargs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "dev": true, + "requires": { + "camelcase": "3.0.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "1.4.0", + "read-pkg-up": "1.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "1.0.2", + "which-module": "1.0.0", + "y18n": "3.2.1", + "yargs-parser": "5.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } + }, + "yargs-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "dev": true, + "requires": { + "camelcase": "3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "dev": true, + "requires": { + "fd-slicer": "1.0.1" + } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 832c538c0..eb43736ed 100644 --- a/package.json +++ b/package.json @@ -3,23 +3,24 @@ "version": "1.0.0", "author": "Verdnatura Levante SL", "description": "Salix application", - "license": "ISC", + "license": "GPL-3.0", "repository": { "type": "git", - "url": "http://git.verdnatura.es:/salix" + "url": "https://git.verdnatura.es/salix" }, "dependencies": { "@uirouter/angularjs": "^1.0.3", - "angular": "^1.6.4", + "angular": "^1.6.8", "angular-cookies": "^1.6.4", "angular-paging": "^2.2.2", - "angular-translate": "^2.13.1", - "angular-translate-loader-partial": "^2.13.1", + "angular-translate": "^2.17.0", + "angular-translate-loader-partial": "^2.17.0", "flatpickr": "^2.6.3", + "fs-extra": "^5.0.0", "material-design-lite": "^1.3.0", "mg-crud": "^1.1.2", - "nodemon": "^1.12.1", "oclazyload": "^0.6.3", + "require-yaml": "0.0.1", "validator": "^6.2.1" }, "devDependencies": { @@ -44,35 +45,39 @@ "gulp-concat": "^2.6.0", "gulp-extend": "^0.2.0", "gulp-install": "^1.1.0", + "gulp-jasmine": "^3.0.0", "gulp-print": "^2.0.1", "gulp-util": "^3.0.7", "gulp-wrap": "^0.13.0", "gulp-yaml": "^1.0.1", "html-loader": "^0.4.4", - "jasmine": "^2.7.0", + "jasmine": "^2.9.0", "jasmine-spec-reporter": "^4.2.1", - "karma": "^1.7.0", + "js-yaml": "^3.10.0", + "json-loader": "^0.5.7", + "karma": "^1.7.1", "karma-chrome-launcher": "^2.2.0", - "karma-firefox-launcher": "^1.0.1", - "karma-jasmine": "^1.1.0", + "karma-firefox-launcher": "^1.1.0", + "karma-jasmine": "^1.1.1", "karma-sourcemap-loader": "^0.3.7", - "karma-webpack": "^2.0.4", + "karma-webpack": "^2.0.9", + "md5": "^2.2.1", "merge-stream": "^1.0.1", + "mustache": "^2.3.0", + "mysql": "^2.15.0", "nightmare": "^2.10.0", - "node-sass": "^3.11.0", + "node-sass": "^4.7.2", + "nodemon": "^1.12.1", "raw-loader": "*", "run-sequence": "^2.2.0", - "sass-loader": "^4.0.2", + "sass-loader": "^4.1.1", "style-loader": "^0.13.1", "webpack": "^2.2.0", - "webpack-dev-server": "^2.2.0" + "webpack-dev-server": "^2.2.0", + "yaml-loader": "^0.5.0" }, "scripts": { - "build": "webpack --progress --colors", - "dev": "webpack-dev-server --progress --colors", - "lint": "eslint ./ --cache --ignore-pattern .gitignore", - "test": "node services_tests", - "testWatcher": "nodemon -q services_tests.js -w services", - "e2e": "node e2e_tests" + "test": "nodemon -q services_tests.js -w services", + "lint": "eslint ./ --cache --ignore-pattern .gitignore" } } diff --git a/services/.gitignore b/services/.gitignore index ebbd90ea9..9792c4ca5 100644 --- a/services/.gitignore +++ b/services/.gitignore @@ -1,20 +1,3 @@ -*.csv -*.dat -*.iml -*.log -*.out -*.pid -*.seed -*.sublime-* -*.swo -*.swp -*.tgz -*.xml -.DS_Store -.idea -.project -.strong-pm -coverage -node_modules -npm-debug.log +datasources.test.json +datasources.development.json db.json diff --git a/services/auth/package.json b/services/auth/package.json index f959ddc95..c7564c7c7 100644 --- a/services/auth/package.json +++ b/services/auth/package.json @@ -7,9 +7,7 @@ "start": "node .", "posttest": "npm run lint && nsp check" }, - "dependencies": { - "md5": "^2.2.1" - }, + "dependencies": {}, "repository": { "type": "git", "url": "https://git.verdnatura.es/salix" diff --git a/services/auth/server/boot/routes.js b/services/auth/server/boot/routes.js index f29e648f9..e84749bc8 100644 --- a/services/auth/server/boot/routes.js +++ b/services/auth/server/boot/routes.js @@ -51,7 +51,7 @@ module.exports = function(app) { continueUrl = null; } - loginUrl = applications[apiKey]; + let loginUrl = applications[apiKey]; res.json({ token: token.id, @@ -85,8 +85,8 @@ module.exports = function(app) { }); app.get('/logout', function(req, res) { - console.log(req.accessToken); - User.logout(req.accessToken.id, - () => res.redirect('/')); + User.logout(req.accessToken.id, () => { + res.redirect('/'); + }); }); }; diff --git a/services/auth/server/boot/specs/routes.spec.js b/services/auth/server/boot/specs/routes.spec.js new file mode 100644 index 000000000..73215ad68 --- /dev/null +++ b/services/auth/server/boot/specs/routes.spec.js @@ -0,0 +1,110 @@ +const app = require('../../../server/server'); +const routes = require('../routes'); +const restoreFixtures = require('../../../../../services/db/testing_fixtures'); + +describe('Auth routes', () => { + let fixturesToApply = {tables: ['`salix`.`user`'], inserts: [ + `INSERT INTO salix.user(id,username,password,email) + VALUES + (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 'JessicaJones@verdnatura.es');` + ]}; + + beforeEach(done => { + restoreFixtures(fixturesToApply, done); + }); + + afterAll(done => { + restoreFixtures(fixturesToApply, done); + }); + + let User = app.models.User; + let loginFunction; + let logoutFunction; + let res; + let req; + + beforeEach(() => { + spyOn(app, 'post'); + spyOn(app, 'get').and.callThrough(); + routes(app); + loginFunction = app.post.calls.mostRecent().args[1]; + logoutFunction = app.get.calls.argsFor(2)[1]; + res = {}; + req = {body: {}}; + }); + + describe('when the user exists and the password is correct', () => { + it('should login and return the token', done => { + req.body.user = 'JessicaJones'; + req.body.password = 'nightmare'; + res.json = response => { + expect(response.token).toBeDefined(); + done(); + }; + loginFunction(req, res); + }); + + describe('when the user doesnt exist but the client does and the password is correct', () => { + it('should create the user login and return the token', done => { + spyOn(User, 'upsertWithWhere').and.callThrough(); + req.body.user = 'PetterParker'; + req.body.password = 'nightmare'; + res.json = response => { + expect(User.upsertWithWhere).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Object), jasmine.any(Function)); + expect(response.token).toBeDefined(); + done(); + }; + loginFunction(req, res); + }); + }); + + it('should define the url to continue upon login', done => { + req.body.user = 'JessicaJones'; + req.body.password = 'nightmare'; + req.body.location = 'http://localhost:5000/auth/?apiKey=salix&continue="continueURL"'; + res.json = response => { + expect(response.continue).toBeDefined(); + done(); + }; + loginFunction(req, res); + }); + + it('should define the loginUrl upon login', done => { + req.body.user = 'JessicaJones'; + req.body.password = 'nightmare'; + req.body.location = 'http://localhost:5000/auth/?apiKey=salix'; + res.json = response => { + expect(response.loginUrl).toBeDefined(); + done(); + }; + loginFunction(req, res); + }); + + it('should logout after login', done => { + spyOn(User, 'logout').and.callThrough(); + req.accessToken = {id: 'testingTokenId'}; + logoutFunction(req, res); + res.redirect = url => { + expect(User.logout).toHaveBeenCalledWith('testingTokenId', jasmine.any(Function)); + expect(url).toBe('/'); + done(); + }; + }); + }); + + describe('when the user is incorrect', () => { + it('should return a 401 unauthorized', done => { + req.body.user = 'IDontExist'; + req.body.password = 'TotallyWrongPassword'; + res.status = status => { + expect(status).toBe(401); + }; + + res.json = response => { + expect(response.message).toBe('Login failed'); + done(); + }; + loginFunction(req, res); + }); + }); +}); diff --git a/services/auth/server/config.json b/services/auth/server/config.json deleted file mode 100644 index 8fb2c57c9..000000000 --- a/services/auth/server/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "port": 3000 -} \ No newline at end of file diff --git a/services/auth/server/model-config.json b/services/auth/server/model-config.json deleted file mode 100644 index 8d0bcc990..000000000 --- a/services/auth/server/model-config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "user": { - "dataSource": "auth" - }, - "AccessToken": { - "dataSource": "auth", - "relations": { - "user": { - "type": "belongsTo", - "model": "user", - "foreignKey": "userId" - } - } - }, - "ACL": { - "dataSource": "auth" - }, - "RoleMapping": { - "dataSource": "auth" - }, - "Role": { - "dataSource": "auth" - }, - "Account": { - "dataSource": "auth" - } -} \ No newline at end of file diff --git a/services/auth/server/server.js b/services/auth/server/server.js index c87c400dc..2819f5729 100644 --- a/services/auth/server/server.js +++ b/services/auth/server/server.js @@ -3,7 +3,4 @@ var vnLoopback = require('../../loopback/server/server.js'); var app = module.exports = vnLoopback.loopback(); app.set('applications', require('./application.json')); -vnLoopback.boot(app, __dirname); -if (require.main === module) { - app.start(); -} +vnLoopback.boot(app, __dirname, module); diff --git a/services/client/Dockerfile b/services/client/Dockerfile deleted file mode 100644 index 2ff9fa445..000000000 --- a/services/client/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:6.9.1 - -COPY client /app - -COPY loopback /loopback - -WORKDIR /app - -RUN npm install - -RUN npm -g install pm2 - -CMD ["pm2-docker", "./server/server.js"] - -EXPOSE 3002 \ No newline at end of file diff --git a/services/client/common/methods/address/crudAddressObservations.js b/services/client/common/methods/address/crudAddressObservations.js new file mode 100644 index 000000000..b158b0749 --- /dev/null +++ b/services/client/common/methods/address/crudAddressObservations.js @@ -0,0 +1,40 @@ +module.exports = Self => { + Self.remoteMethod('crudAddressObservations', { + description: 'create, delete or update address observations', + accessType: 'WRITE', + accepts: [ + { + arg: 'observations', + type: 'Object', + require: true, + description: 'object with observations to create, delete or update, Example: {delete: [], create: [], update: []}', + http: {source: 'body'} + } + ], + returns: { + arg: 'sumAmount' + }, + http: { + path: `/crudAddressObservations`, + verb: 'post' + } + }); + + Self.crudAddressObservations = observations => { + let promises = []; + + if (observations.delete.length) { + promises.push(Self.destroyAll({id: {inq: observations.delete}})); + } + if (observations.create.length) { + promises.push(Self.create(observations.create)); + } + if (observations.update.length) { + observations.update.forEach(observation => { + promises.push(Self.upsert(observation)); + }); + } + + return Promise.all(promises); + }; +}; diff --git a/services/client/common/methods/client/activate.js b/services/client/common/methods/client/activate.js deleted file mode 100644 index bfce30ea3..000000000 --- a/services/client/common/methods/client/activate.js +++ /dev/null @@ -1,64 +0,0 @@ -var request = require('request'); -var app = require('../../../server/server'); - -module.exports = function(Client) { - Client.remoteMethod('activate', { - description: 'Activate or deactive client', - accepts: [ - { - arg: 'id', - type: 'number', - required: true, - description: 'Model id', - http: {source: 'path'} - }, { - arg: 'context', - type: 'object', - http: function(ctx) { - return ctx; - } - } - ], - returns: { - arg: 'active', - type: 'boolean' - }, - http: { - verb: 'put', - path: '/:id/activate' - } - }); - - Client.activate = function(id, ctx, cb) { - Client.findById(id, function(err, client) { - if(!err) { - Client.update({id: client.id}, {active: !client.active}); - - let filter = {where: {clientFk: client.id}, fields: ['started', 'ended']}; - - app.models.CreditClassification.findOne(filter, function(error, data) { - if (error) - return; - - let currentDate = new Date(); - - if (data && client.active && (data.ended >= currentDate || data.ended == null)) { - let host = ctx.req.headers.host.split(':')[0]; - var options = { - url: `http://${host}:5000/mailer/notification/client-deactivate/${client.id}`, - method: 'POST', - headers: { - 'content-type': 'application/json', - 'authorization': ctx.req.headers.authorization - }, - json: {} - }; - request(options); - } - }); - - cb(null, !client.active); - } - }); - }; -}; diff --git a/services/client/common/methods/client/before-save.js b/services/client/common/methods/client/before-save.js deleted file mode 100644 index 74b9ce7a6..000000000 --- a/services/client/common/methods/client/before-save.js +++ /dev/null @@ -1,152 +0,0 @@ -var app = require('../../../server/server'); - -module.exports = function(Client) { - var CREDIT_CARD = 5; - var models = app.models; - - Client.observe('before save', function(ctx, next) { - if (ctx.currentInstance) { - let dataChange = Object.assign({}, ctx.data); - let userId = ctx.options.accessToken.userId; - - Object.assign(ctx.data, doIfNullSalesPerson(ctx.currentInstance)); - - if (!ctx.data.dueDay) - ctx.data.dueDay = 5; - - if (dataChange.hasOwnProperty('equalizationTax') && !canMarkEqualizationTax(ctx.data)) - next(generateErrorEqualizationTax()); - else if (dataChange.hasOwnProperty('credit')) - canChangeCredit(dataChange, userId, next); - else - next(); - } else if (ctx.where && ctx.where.id) { - Client.findById(ctx.where.id, (_, instance) => { - Object.assign(ctx.data, doIfNullSalesPerson(instance)); - - if (instance - && instance.payMethodFk != ctx.data.payMethodFk - && instance.dueDay == ctx.data.dueDay) - ctx.data.dueDay = 5; - - if (instance.fi && ctx.data.equalizationTax && !canMarkEqualizationTax(instance)){ - next(generateErrorEqualizationTax()); - } else if (instance.equalizationTax !== undefined && instance.equalizationTax && ctx.data.fi && canMarkEqualizationTax(ctx.data)){ - next(generateErrorEqualizationTax()); - } else { - next(); - } - }); - } else { - // newInstance - next(); - } - }); - - function doIfNullSalesPerson(instance) { - var data = {}; - if (instance.salesPerson === null) { - data.credit = 0; - data.discount = 0; - data.payMethodFk = CREDIT_CARD; - } - return data; - } - - function canMarkEqualizationTax(instance) { - var firstLetter = (instance && instance.fi) ? instance.fi.toUpperCase().charAt(0) : ''; - if (firstLetter == "A" || firstLetter == "B") - return false; - return true; - } - - function generateErrorEqualizationTax() { - var error = new Error(); - error.message = "No se puede marcar el recargo de equivalencia"; - error.status = 500; - return error; - } - - function generateErrorCredit() { - var error = new Error(); - error.message = "No tienes privilegios para modificar el crédito"; - error.status = 500; - return error; - } - - function canChangeCredit(data, userId, done) { - let filter = { - fields: ['roleFk'], - where: { - maxAmount: {gt: data.credit} - } - }; - - models.ClientCreditLimit.find(filter, - (_, res) => limitCb(_, res)); - - function limitCb(_, instances) { - let requiredRoles = []; - for (instance of instances) - requiredRoles.push(instance.roleFk); - - let where = { - roleId: {inq: requiredRoles}, - principalType: 'USER', - principalId: userId - }; - models.RoleMapping.count(where, - (_, res) => roleCb(_, res)); - } - function roleCb(_, count) { - // si el usuario no tiene alguno de los roles no continua - if (count <= 0) { - done(generateErrorCredit()); - return; - } - // si tiene el rol hay que validar que el último movimiento no fuese crédito 0 insertado por gerencia - validate(); - } - - // Si se puso a 0 por gerencia, solo gerencia puede aumentarlo - function validate() { - let query = 'SELECT * FROM ClientCredit WHERE clientFk = ? ORDER BY created DESC LIMIT 1'; - Client.dataSource.connector.execute(query, [data.id], - (_, res) => maxCb(_, res)); - } - - function maxCb(_, instances) { - if (!instances) { - done(generateErrorCredit()); - return; - } - - if (instances.length !== 1 || instances[0].employeeFk == userId || instances[0].amount > 0) { - done(); - return; - } - - // el ultimo registro tiene valor 0, hay que comprobar que no fue editado por un gerente - let sql = `SELECT count(distinct r.id) as hasManagerRole - FROM ClientCredit cc - JOIN Employee em ON (em.id = cc.employeeFk) - JOIN Account ac ON (ac.id = em.userFk) - JOIN RoleMapping rm ON (rm.principalId = ac.id) - JOIN Role r on (r.id = rm.roleId) - WHERE rm.principalType = 'USER' - AND cc.employeeFk = ? - AND r.\`name\` = 'manager'`; - - Client.dataSource.connector.execute(sql, [instances[0].employeeFk], (_, res) => clientCreditCb(_, res)); - } - - function clientCreditCb(_, instance) { - if (!instance || (instance.length && instance[0].hasManagerRole > 0)) { - done(generateErrorCredit()); - return; - } - done(); - } - } -}; - diff --git a/services/client/common/methods/client/card.js b/services/client/common/methods/client/card.js deleted file mode 100644 index bd2c4ca81..000000000 --- a/services/client/common/methods/client/card.js +++ /dev/null @@ -1,46 +0,0 @@ -module.exports = function(Client) { - Client.remoteMethod('card', { - description: 'Get client for card call', - accepts: { - arg: 'id', - type: 'number', - required: true, - description: 'Model id', - http: {source: 'path'} - }, - returns: { - arg: 'data', - type: 'Client', - root: true - }, - http: { - verb: 'get', - path: '/:id/card' - } - }); - - Client.card = function(id, cb) { - let filter = { - where: { - id: id - }, - include: require('./card.json') - }; - - Client.find(filter, function(err, instances) { - if (!err) { - cb(null, formatCard(instances[0])); - } - }); - }; - - function formatCard(card) { - let cardFormated = JSON.parse(JSON.stringify(card)); - if (cardFormated.salesPersonFk) - cardFormated.salesPerson = { - id: card.salesPerson().id, - name: `${card.salesPerson().name} ${card.salesPerson().surname}` - }; - return cardFormated; - } -}; diff --git a/services/client/common/methods/client/card.json b/services/client/common/methods/client/card.json deleted file mode 100644 index e9224b2ab..000000000 --- a/services/client/common/methods/client/card.json +++ /dev/null @@ -1,33 +0,0 @@ -[ - { - "relation": "salesPerson", - "scope": { - "fields": ["id", "name", "surname"] - } - }, { - "relation": "contactChannel", - "scope": { - "fields": ["id", "name"] - } - }, { - "relation": "province", - "scope": { - "fields": ["id", "name"] - } - }, { - "relation": "country", - "scope": { - "fields": ["id", "name"] - } - }, { - "relation": "payMethod", - "scope": { - "fields": ["id", "name"] - } - }, { - "relation": "account", - "scope": { - "fields": ["id", "name", "active"] - } - } -] \ No newline at end of file diff --git a/services/client/common/methods/client/employee.js b/services/client/common/methods/client/employee.js deleted file mode 100644 index 8ad6dbbaa..000000000 --- a/services/client/common/methods/client/employee.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = function(Client) { - Client.remoteMethod('employeeList', { - description: 'List employee', - accessType: 'READ', - returns: { - arg: 'data', - type: 'Employee', - root: true - }, - http: { - path: `/employeeList`, - verb: 'get' - } - }); - - let getEmployees = listEmployees => { - let employees = []; - listEmployees.forEach(function(e) { - employees.push({id: e.id, name: e.name}); - }, this); - return employees; - }; - - Client.employeeList = function(callback) { - let query = `SELECT em.id, CASE em.surname WHEN NULL THEN em.name ELSE concat(em.name, " ", em.surname) END \`name\` - FROM Employee em - JOIN Account ac ON em.userFk = ac.id - JOIN RoleMapping rm on ac.id=rm.principalId - JOIN Role rl on rm.roleId = rl.id - WHERE ac.active - and rl.\`name\`='employee' - ORDER BY em.name ASC`; - - Client.rawSql(query, [], callback) - .then(response => { - callback(null, getEmployees(response)); - }) - .catch(reject => { - callback(reject, null); - }); - }; -}; diff --git a/services/client/common/methods/client/filter.js b/services/client/common/methods/client/filter.js deleted file mode 100644 index 0307ac068..000000000 --- a/services/client/common/methods/client/filter.js +++ /dev/null @@ -1,48 +0,0 @@ -module.exports = function(Client) { - Client.installMethod('filter', filterClients); - - function filterClients(params) { - if (params.search) - return searchWhere(params); - return andWhere(params); - } - - function searchWhere(params) { - return { - where: { - or: [ - {id: params.search}, - {name: {regexp: params.search}} - ] - - }, - skip: (params.page - 1) * params.size, - limit: params.size - }; - } - - function andWhere(params) { - let filters = { - where: {}, - skip: (params.page - 1) * params.size, - limit: params.size - }; - - delete params.page; - delete params.size; - - if (params.phone) { - filters.where.or = [ - {phone: params.phone}, - {mobile: params.phone} - ]; - delete params.phone; - } - Object.keys(params).forEach( - key => { - filters.where[key] = (key === 'postcode' || key === 'fi') ? params[key] : {regexp: params[key]}; - } - ); - return filters; - } -}; diff --git a/services/client/common/methods/client/roles.js b/services/client/common/methods/client/roles.js deleted file mode 100644 index 1e8a1f475..000000000 --- a/services/client/common/methods/client/roles.js +++ /dev/null @@ -1,45 +0,0 @@ -module.exports = Client => { - Client.remoteMethod('getRoleCustomer', { - description: 'devuelve true/false si es Customer el client', - accessType: 'READ', - accepts: [ - { - arg: 'id', - type: 'string', - required: true, - description: 'Model id', - http: {source: 'path'} - }, - { - arg: 'filter', - type: 'object', - required: true, - description: 'Filter defining where', - http: function(context) { - return context.req.query; - } - } - ], - returns: { - arg: 'data', - type: 'boolean', - root: true - }, - http: { - path: `/:id/getRoleCustomer`, - verb: 'get' - } - }); - - Client.getRoleCustomer = (id, context, callback) => { - let query = `SELECT count(*) isCustomer FROM Account ac JOIN Role ON Role.id = ac.roleFK WHERE Role.\`name\`='customer' AND ac.id IN (?)`; - const params = [id]; - Client.rawSql(query, params, callback) - .then(response => { - callback(null, response[0]); - }) - .catch(reject => { - callback(reject, null); - }); - }; -}; diff --git a/services/client/common/methods/client/salesperson.js b/services/client/common/methods/client/salesperson.js deleted file mode 100644 index dde54fe9f..000000000 --- a/services/client/common/methods/client/salesperson.js +++ /dev/null @@ -1,64 +0,0 @@ -module.exports = (Client) => { - Client.remoteMethod('activeSalesPerson', { - description: 'returns actives employees with salesperson role', - accessType: 'READ', - accepts: [{ - arg: 'filter', - type: 'Object', - required: false, - description: 'Filter defining where and paginated data', - http: {source: 'query'} - }], - returns: { - arg: 'data', - type: 'Employee', - root: true - }, - http: { - path: `/activeSalesPerson`, - verb: 'get' - } - }); - - Client.activeSalesPerson = (filter, callback) => { - let skip = filter.skip || 0; - let limit = filter.limit || 10; - let where = getCondition(filter.where); - - let query = `SELECT em.id, em.name, em.surname - FROM Employee em - JOIN Account ac ON em.userFk = ac.id - JOIN Role ON Role.id = ac.roleFK - WHERE ac.active AND Role.\`name\`='salesPerson' ${where.cond} - ORDER BY em.name ASC - LIMIT ? OFFSET ?`; - - Client.rawSql(query, [where.value, parseInt(limit, 10), parseInt(skip, 10)], callback) - .then(response => { - callback(null, formatSalesPerson(response)); - }) - .catch(reject => { - callback(reject, null); - }); - }; - - function getCondition(where) { - let out = {}; - out.cond = (typeof where === 'object' && where.name && where.name.regexp) ? `AND em.name regexp ?` : '?'; - out.value = (typeof where === 'object' && where.name && where.name.regexp) ? where.name.regexp : ''; - return out; - } - - function formatSalesPerson(response) { - let results = []; - - response.forEach(person => { - results.push({ - id: person.id, - name: `${person.name} ${person.surname}` - }); - }); - - return results; - } -}; \ No newline at end of file diff --git a/services/client/common/methods/client/specs/create.spec.js b/services/client/common/methods/client/specs/create.spec.js deleted file mode 100644 index a19ef074c..000000000 --- a/services/client/common/methods/client/specs/create.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import {catchErrors} from '../../../../../../services/utils/jasmineHelpers'; -let app = require('../../../../server/server'); - -describe('Client Create()', () => { - let data = { - name: 'MaxEisenhardt', - userName: 'Magneto', - email: 'magneto@marvel.com', - fi: 'X-tax number', - socialName: 'The X-Men' - }; - - it('should createa new account', done => { - app.models.Client.createUserProfile(data, () => { - app.models.Account.findOne({where: {name: data.userName}}) - .then(account => { - expect(account.name).toEqual(data.userName); - app.models.Client.findOne({where: {name: data.name}}) - .then(client => { - expect(client.id).toEqual(account.id); - expect(client.name).toEqual(data.name); - expect(client.email).toEqual(data.email); - expect(client.fi).toEqual(data.fi); - expect(client.socialName).toEqual(data.socialName); - done(); - }); - }) - .catch(catchErrors(done)); - }); - }); -}); diff --git a/services/client/common/methods/greuge/filter.js b/services/client/common/methods/greuge/filter.js new file mode 100644 index 000000000..dba4e8ef6 --- /dev/null +++ b/services/client/common/methods/greuge/filter.js @@ -0,0 +1,20 @@ +module.exports = Self => { + Self.installMethod('filter', filterParams); + + function filterParams(params) { + return { + where: { + clientFk: params.clientFk + }, + skip: (params.page - 1) * params.size, + limit: params.size, + order: params.order || 'shipped DESC', + include: { + relation: "greugeType", + scope: { + fields: ["id", "name"] + } + } + }; + } +}; diff --git a/services/client/common/methods/greuge/specs/sumAmount.spec.js b/services/client/common/methods/greuge/specs/sumAmount.spec.js new file mode 100644 index 000000000..41339702a --- /dev/null +++ b/services/client/common/methods/greuge/specs/sumAmount.spec.js @@ -0,0 +1,19 @@ +const totalGreuge = require('../sumAmount'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; + +describe('Greuge totalGreuge()', () => { + it('should call the sumAmount method', done => { + let clientFk = 1; + let self = jasmine.createSpyObj('self', ['remoteMethod', 'rawSql']); + self.rawSql.and.returnValue(Promise.resolve([{sumAmount: 6000}])); + totalGreuge(self); + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toBe(6000); + done(); + }; + self.sumAmount(clientFk, callback); + }); +}); diff --git a/services/client/common/methods/greuge/sumAmount.js b/services/client/common/methods/greuge/sumAmount.js new file mode 100644 index 000000000..0fa8d9034 --- /dev/null +++ b/services/client/common/methods/greuge/sumAmount.js @@ -0,0 +1,31 @@ +module.exports = Self => { + Self.remoteMethod('sumAmount', { + description: 'Returns the sum of greuge for a client', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'clientFk', + http: {source: 'path'} + }], + returns: { + arg: 'sumAmount' + }, + http: { + path: `/:id/sumAmount`, + verb: 'get' + } + }); + + Self.sumAmount = (clientFk, callback) => { + let query = `SELECT SUM(amount) AS sumAmount FROM vn.greuge WHERE clientFk = ?`; + Self.rawSql(query, [clientFk]) + .then(response => { + callback(null, response.length ? response[0].sumAmount : 0); + }) + .catch(err => { + callback(err); + }); + }; +}; diff --git a/services/client/common/methods/mandate/filter.js b/services/client/common/methods/mandate/filter.js new file mode 100644 index 000000000..03482cd72 --- /dev/null +++ b/services/client/common/methods/mandate/filter.js @@ -0,0 +1,28 @@ +module.exports = Self => { + Self.installMethod('filter', filterParams); + + function filterParams(params) { + return { + where: { + clientFk: params.clientFk + }, + skip: (params.page - 1) * params.size, + limit: params.size, + order: params.order || 'created DESC', + include: [ + { + relation: "mandateType", + scope: { + fields: ["id", "name"] + } + }, + { + relation: "company", + scope: { + fields: ["id", "code"] + } + } + ] + }; + } +}; diff --git a/services/client/common/models/address-observation.js b/services/client/common/models/address-observation.js new file mode 100644 index 000000000..579a47adf --- /dev/null +++ b/services/client/common/models/address-observation.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + require('../methods/address/crudAddressObservations.js')(Self); +}; diff --git a/services/client/common/models/address-observation.json b/services/client/common/models/address-observation.json new file mode 100644 index 000000000..53b6155ec --- /dev/null +++ b/services/client/common/models/address-observation.json @@ -0,0 +1,34 @@ +{ + "name": "AddressObservation", + "base": "VnModel", + "options": { + "mysql": { + "table": "addressObservation", + "database": "vn" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "string", + "required": true + } + }, + "relations": { + "address": { + "type": "belongsTo", + "model": "Address", + "foreignKey": "addressFk" + }, + "observationType": { + "type": "belongsTo", + "model": "ObservationType", + "foreignKey": "observationTypeFk" + } + } + } + \ No newline at end of file diff --git a/services/client/common/models/address.js b/services/client/common/models/address.js deleted file mode 100644 index 53c0bcbad..000000000 --- a/services/client/common/models/address.js +++ /dev/null @@ -1,75 +0,0 @@ -module.exports = function(Self) { - Self.validate('default', isEnabled, {message: 'No se puede poner predeterminado un consignatario desactivado'}); - function isEnabled(err) { - if (!this.isEnabled && this.isDefaultAddress) err(); - } - - Self.beforeRemote('create', function(ctx, modelInstance, next) { - var data = ctx.req.body; - create(data, next); - }); - - function create(data, next) { - if (data.isDefaultAddress) { - removeAllDefault(data, next); - } else { - next(); - } - } - - Self.beforeRemote('prototype.patchAttributes', function(ctx, modelInstance, next) { - let newData = ctx.req.body; - newData.id = ctx.req.params.id; - getAddress(ctx, newData, next); - }); - - Self.beforeRemote('findById', function(ctx, modelInstance, next) { - ctx.args.filter = { - include: [{ - relation: "province", - scope: { - fields: ["id", "name"] - } - }, - { - relation: "defaultAgency", - scope: { - fields: ["id", "name"] - } - } - ] - }; - next(); - }); - - function getAddress(ctx, newData, next) { - Self.findOne({where: {id: newData.id}}, (_, oldData) => { - if (oldData) - callbackGetAddress(ctx, newData, oldData, next); - }); - } - - function callbackGetAddress(ctx, newData, oldData, next) { - if (newData.isDefaultAddress) { - removeAllDefault(oldData, next); - } else if (oldData.isDefaultAddress && newData.hasOwnProperty('isDefaultAddress') && !newData.isDefaultAddress) { - next(generateErrorDefaultAddress()); - } else - next(); - } - - function removeAllDefault(client, next) { - if (client && client.clientFk) - Self.updateAll({clientFk: client.clientFk, isDefaultAddress: {neq: 0}}, {isDefaultAddress: false}, next); - else - next(); - } - - function generateErrorDefaultAddress() { - var error = new Error(); - error.message = "No se puede desmarcar el consignatario predeterminado"; - error.status = 500; - return error; - } -}; - diff --git a/services/client/common/models/agency-mode.json b/services/client/common/models/agency-mode.json index 4e1b4b048..ebac22a77 100644 --- a/services/client/common/models/agency-mode.json +++ b/services/client/common/models/agency-mode.json @@ -1,6 +1,12 @@ { "name": "AgencyMode", + "description": "Agency modes", "base": "VnModel", + "options": { + "mysql": { + "table": "agencyMode" + } + }, "properties": { "id": { "type": "Number", @@ -20,7 +26,7 @@ "inflation": { "type": "Number" }, - "sendMailTo": { + "reportMail": { "type": "string" } }, diff --git a/services/client/common/models/client-credit.js b/services/client/common/models/client-credit.js new file mode 100644 index 000000000..7a85976ca --- /dev/null +++ b/services/client/common/models/client-credit.js @@ -0,0 +1,20 @@ +module.exports = function(Self) { + Self.installMethod('filter', filterParams); + + function filterParams(params) { + return { + where: { + clientFk: params.clientFk + }, + skip: (params.page - 1) * params.size, + limit: params.size, + order: params.order || 'created DESC', + include: { + relation: "worker", + scope: { + fields: ["id", "firstName", "name"] + } + } + }; + } +}; diff --git a/services/client/common/models/client-credit.json b/services/client/common/models/client-credit.json index f6512bfc7..96ea26829 100644 --- a/services/client/common/models/client-credit.json +++ b/services/client/common/models/client-credit.json @@ -1,6 +1,13 @@ { "name": "ClientCredit", + "description": "Log of credit changes", "base": "VnModel", + "options": { + "mysql": { + "table": "clientCredit", + "database": "vn" + } + }, "validateUpsert": true, "properties": { "id": { @@ -21,10 +28,10 @@ "model": "Client", "foreignKey": "clientFk" }, - "employee": { + "worker": { "type": "belongsTo", - "model": "Employee", - "foreignKey": "employeeFk" + "model": "Worker", + "foreignKey": "workerFk" } } } \ No newline at end of file diff --git a/services/client/common/models/client-observation.js b/services/client/common/models/client-observation.js index 39470f4c7..1ae98fe67 100644 --- a/services/client/common/models/client-observation.js +++ b/services/client/common/models/client-observation.js @@ -8,13 +8,11 @@ module.exports = function(Self) { ctx.instance.created = Date(); let token = ctx.options.accessToken; let userId = token && token.userId; - let app = require('../../server/server'); - let Employee = app.models.Employee; - Employee.findOne({where: {userFk: userId}}, function (err, user){ - if (user){ - ctx.instance.employeeFk = user.id; - next(); - } + + Self.app.models.Worker.findOne({where: {userFk: userId}}, (err, user) => { + if (err) return next(err); + ctx.instance.workerFk = user.id; + next(); }); }); }; diff --git a/services/client/common/models/client-observation.json b/services/client/common/models/client-observation.json index f209ee468..47654b134 100644 --- a/services/client/common/models/client-observation.json +++ b/services/client/common/models/client-observation.json @@ -1,7 +1,12 @@ { "name": "ClientObservation", - "description": "Notas de los clientes.", + "description": "Client notes", "base": "VnModel", + "options": { + "mysql": { + "table": "clientObservation" + } + }, "properties": { "id": { "type": "Number", @@ -21,10 +26,10 @@ } }, "relations": { - "employee": { + "worker": { "type": "belongsTo", - "model": "Employee", - "foreignKey": "employeeFk" + "model": "Worker", + "foreignKey": "workerFk" }, "client": { "type": "hasOne", @@ -33,6 +38,6 @@ } }, "scope": { - "include": "employee" + "include": "worker" } } diff --git a/services/client/common/models/client.js b/services/client/common/models/client.js deleted file mode 100644 index 321e4f055..000000000 --- a/services/client/common/models/client.js +++ /dev/null @@ -1,74 +0,0 @@ -var app = require('../../server/server'); - -module.exports = function(Self) { - var models = app.models; - - // Methods - - require('../methods/client/activate.js')(Self); - require('../methods/client/addresses.js')(Self); - require('../methods/client/before-save.js')(Self); - require('../methods/client/card.js')(Self); - require('../methods/client/create.js')(Self); - require('../methods/client/employee.js')(Self); - require('../methods/client/filter.js')(Self); - require('../methods/client/roles.js')(Self); - require('../methods/client/salesperson.js')(Self); - require('../methods/client/addressesPropagateRe.js')(Self); - - // Validations - - Self.validatesUniquenessOf('name', { - message: 'El nombre debe ser único' - }); - Self.validatesUniquenessOf('fi', { - message: 'El NIF/CIF debe ser único' - }); - Self.validatesPresenceOf('socialName', { - message: 'Debe especificarse la razón social' - }); - Self.validatesUniquenessOf('socialName', { - message: 'La razón social debe ser única' - }); - Self.validatesFormatOf('postcode', { - message: 'El código postal solo debe contener números', - allowNull: true, - allowBlank: true, - with: /^\d+$/ - }); - Self.validatesFormatOf('email', { - message: 'Correo electrónico inválido', - allowNull: true, - allowBlank: true, - with: /^[\w|\.|\-]+@\w[\w|\.|\-]*\w(,[\w|\.|\-]+@\w[\w|\.|\-]*\w)*$/ - }); - Self.validatesLengthOf('postcode', { - allowNull: true, - allowBlank: true, - min: 3, max: 10 - }); - - var validateIban = require('../validations/validateIban'); - Self.validateBinded('iban', validateIban, { - message: 'El iban no tiene el formato correcto' - }); - - Self.validate('payMethod', hasSalesMan, { - message: 'No se puede cambiar la forma de pago si no hay comercial asignado' - }); - function hasSalesMan(err) { - if (this.payMethod && !this.salesPerson) - err(); - } - Self.validateAsync('payMethodFk', hasIban, { - message: 'El método de pago seleccionado requiere que se especifique el IBAN' - }); - - function hasIban(err, done) { - models.PayMethod.findById(this.payMethodFk, (_, instance) => { - if (instance && instance.ibanRequired && !this.iban) - err(); - done(); - }); - } -}; diff --git a/services/client/common/models/company.json b/services/client/common/models/company.json new file mode 100644 index 000000000..d3700bad6 --- /dev/null +++ b/services/client/common/models/company.json @@ -0,0 +1,20 @@ +{ + "name": "Company", + "description": "Companies", + "base": "VnModel", + "options": { + "mysql": { + "table": "company" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "code": { + "type": "String" + } + } + } \ No newline at end of file diff --git a/services/client/common/models/greuge-type.json b/services/client/common/models/greuge-type.json new file mode 100644 index 000000000..642f66ee2 --- /dev/null +++ b/services/client/common/models/greuge-type.json @@ -0,0 +1,19 @@ +{ + "name": "GreugeType", + "base": "VnModel", + "options": { + "mysql": { + "table": "greugeType" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "name": { + "type": "String" + } + } + } \ No newline at end of file diff --git a/services/client/common/models/greuge.js b/services/client/common/models/greuge.js new file mode 100644 index 000000000..85a8b3c84 --- /dev/null +++ b/services/client/common/models/greuge.js @@ -0,0 +1,9 @@ +module.exports = function(Self) { + require('../methods/greuge/filter.js')(Self); + require('../methods/greuge/sumAmount.js')(Self); + + Self.validatesLengthOf('description', { + max: 45, + message: 'La description debe tener maximo 45 caracteres' + }); +}; diff --git a/services/client/common/models/greuge.json b/services/client/common/models/greuge.json new file mode 100644 index 000000000..8524d3e19 --- /dev/null +++ b/services/client/common/models/greuge.json @@ -0,0 +1,43 @@ +{ + "name": "Greuge", + "base": "VnModel", + "options": { + "mysql": { + "table": "greuge" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "description": { + "type": "String", + "required": true + }, + "amount": { + "type": "Number", + "required": true + }, + "shipped": { + "type": "date" + }, + "created": { + "type": "date" + } + }, + "relations": { + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + }, + "greugeType": { + "type": "belongsTo", + "model": "GreugeType", + "foreignKey": "greugeTypeFk", + "required": true + } + } + } \ No newline at end of file diff --git a/services/client/common/models/mandate.js b/services/client/common/models/mandate.js new file mode 100644 index 000000000..82fbd6bb4 --- /dev/null +++ b/services/client/common/models/mandate.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + require('../methods/mandate/filter.js')(Self); +}; diff --git a/services/client/common/models/mandate.json b/services/client/common/models/mandate.json new file mode 100644 index 000000000..a671c45f1 --- /dev/null +++ b/services/client/common/models/mandate.json @@ -0,0 +1,42 @@ +{ + "name": "Mandate", + "base": "VnModel", + "options": { + "mysql": { + "table": "mandate" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "code": { + "type": "String" + }, + "created": { + "type": "date" + }, + "finished": { + "type": "date" + } + }, + "relations": { + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + }, + "company": { + "type": "belongsTo", + "model": "Company", + "foreignKey": "companyFk" + }, + "mandateType": { + "type": "belongsTo", + "model": "MandateType", + "foreignKey": "mandateTypeFk" + } + } + } \ No newline at end of file diff --git a/services/client/common/models/mandateType.json b/services/client/common/models/mandateType.json new file mode 100644 index 000000000..8bd46ce19 --- /dev/null +++ b/services/client/common/models/mandateType.json @@ -0,0 +1,19 @@ +{ + "name": "MandateType", + "base": "VnModel", + "options": { + "mysql": { + "table": "mandateType" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "name": { + "type": "String" + } + } + } \ No newline at end of file diff --git a/services/client/common/models/observation-type.json b/services/client/common/models/observation-type.json new file mode 100644 index 000000000..b1a45e883 --- /dev/null +++ b/services/client/common/models/observation-type.json @@ -0,0 +1,22 @@ +{ + "name": "ObservationType", + "base": "VnModel", + "options": { + "mysql": { + "table": "observationType", + "database": "vn" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "string", + "required": true + } + } + } + \ No newline at end of file diff --git a/services/client/package.json b/services/client/package.json index e37c7ab5a..d6a815f19 100644 --- a/services/client/package.json +++ b/services/client/package.json @@ -13,7 +13,6 @@ "url": "https://git.verdnatura.es/salix" }, "dependencies": { - "loopback-context": "^3.3.0", "request": "^2.83.0" } } diff --git a/services/client/server/config.json b/services/client/server/config.json deleted file mode 100644 index 62f1e3972..000000000 --- a/services/client/server/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "port": 3002 -} diff --git a/services/client/server/i18n/en.json b/services/client/server/i18n/en.json deleted file mode 100644 index a62e31b81..000000000 --- a/services/client/server/i18n/en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Hello": "Hello english" -} \ No newline at end of file diff --git a/services/client/server/i18n/es.json b/services/client/server/i18n/es.json deleted file mode 100644 index 0ef9e258e..000000000 --- a/services/client/server/i18n/es.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Hello": "Hola español" -} diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index fd4618730..562e7e40f 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -1,63 +1,32 @@ { - "user": { - "dataSource": "auth" - }, - "AccessToken": { - "dataSource": "auth", - "relations": { - "user": { - "type": "belongsTo", - "model": "user", - "foreignKey": "userId" - } - } - }, - "ACL": { - "dataSource": "auth" - }, - "RoleMapping": { - "dataSource": "auth" - }, - "Role": { - "dataSource": "auth" - }, - "Account": { - "dataSource": "auth" - }, - "Client": { - "dataSource": "vn" - }, - "ClientCredit": { - "dataSource": "vn" - }, - "ClientCreditLimit": { - "dataSource": "vn" - }, - "ClientObservation": { - "dataSource": "vn" - }, - "PayMethod": { - "dataSource": "vn" - }, - "Address": { + "AddressObservation": { "dataSource": "vn" }, "AgencyMode": { "dataSource": "vn" }, - "Province": { + "ClientCredit": { "dataSource": "vn" }, - "Country": { + "ClientObservation": { "dataSource": "vn" }, - "ContactChannel": { + "Company": { "dataSource": "vn" }, - "Employee": { + "Greuge": { "dataSource": "vn" }, - "CreditClassification": { - "dataSource": "vn" + "GreugeType": { + "dataSource": "vn" + }, + "Mandate": { + "dataSource": "vn" + }, + "MandateType": { + "dataSource": "vn" + }, + "ObservationType": { + "dataSource": "vn" } } diff --git a/services/client/server/server.js b/services/client/server/server.js index eda31589d..030bbc1b4 100644 --- a/services/client/server/server.js +++ b/services/client/server/server.js @@ -2,7 +2,4 @@ var vnLoopback = require('../../loopback/server/server.js'); var app = module.exports = vnLoopback.loopback(); -vnLoopback.boot(app, __dirname); -if (require.main === module) { - app.start(); -} +vnLoopback.boot(app, __dirname, module); diff --git a/services/db/.gitignore b/services/db/.gitignore new file mode 100644 index 000000000..f26f7a0a6 --- /dev/null +++ b/services/db/.gitignore @@ -0,0 +1 @@ +connect.ini diff --git a/services/db/localDB01Structure.sql b/services/db/01-structure.sql similarity index 82% rename from services/db/localDB01Structure.sql rename to services/db/01-structure.sql index ce134804a..f6781374c 100644 --- a/services/db/localDB01Structure.sql +++ b/services/db/01-structure.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64) +-- MySQL dump 10.16 Distrib 10.1.29-MariaDB, for debian-linux-gnu (x86_64) -- --- Host: 127.0.0.1 Database: vncontrol +-- Host: test-db.verdnatura.es Database: account -- ------------------------------------------------------ --- Server version 5.6.37 +-- Server version 5.6.25-4-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -16,815 +16,312 @@ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- --- Current Database: `vncontrol` +-- Current Database: `account` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `vncontrol` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `account` /*!40100 DEFAULT CHARACTER SET utf8 */; -USE `vncontrol`; +USE `account`; -- --- Table structure for table `accion` +-- Table structure for table `account` -- -DROP TABLE IF EXISTS `accion`; +DROP TABLE IF EXISTS `account`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `accion` ( - `accion_id` int(11) NOT NULL AUTO_INCREMENT, - `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`accion_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `clientes_match` --- - -DROP TABLE IF EXISTS `clientes_match`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `clientes_match` ( - `Id_cliente` int(11) NOT NULL, - `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `daily_task_log` --- - -DROP TABLE IF EXISTS `daily_task_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `daily_task_log` ( - `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `fallo` --- - -DROP TABLE IF EXISTS `fallo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `fallo` ( - `queja_id` int(10) unsigned NOT NULL, - `accion_id` int(11) NOT NULL, - PRIMARY KEY (`queja_id`,`accion_id`), - KEY `accion` (`accion_id`,`queja_id`), - KEY `fallo` (`queja_id`), - CONSTRAINT `accion` FOREIGN KEY (`accion_id`) REFERENCES `accion` (`accion_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `inter` --- - -DROP TABLE IF EXISTS `inter`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `inter` ( - `inter_id` int(11) NOT NULL AUTO_INCREMENT, - `state_id` tinyint(3) unsigned NOT NULL, - `fallo_id` int(10) unsigned NOT NULL DEFAULT '21', - `nota` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `Id_Ticket` int(11) DEFAULT NULL, - `Id_Trabajador` int(11) DEFAULT NULL, - `Id_Supervisor` int(11) DEFAULT NULL, - PRIMARY KEY (`inter_id`), - KEY `currante` (`Id_Trabajador`), - KEY `responsable` (`Id_Supervisor`), - KEY `ticket` (`Id_Ticket`), - KEY `inter_state` (`state_id`), - CONSTRAINT `currante` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, - CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn2008`.`state` (`id`) ON UPDATE CASCADE, - CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `interBeforeInsert` -BEFORE INSERT ON `inter` FOR EACH ROW -BEGIN - - DECLARE contados INT; - DECLARE vSupervisor INT; - - SELECT Id_Trabajador INTO vSupervisor FROM vn2008.Trabajadores WHERE user_id = account.userGetId(); - - SET NEW.Id_Supervisor = IFNULL(vSupervisor,5); - - IF NEW.state_id = 5 - THEN - SELECT count(Id_Ticket) INTO contados - FROM vncontrol.inter - WHERE state_id = 5 - AND Id_Ticket = NEW.Id_Ticket - AND IFNULL(Id_Supervisor,-1) <> vSupervisor - AND TIMESTAMPADD(SECOND, 60, odbc_date) >= NOW(); - - IF contados <> 0 THEN - CALL util.throw ('FALLO_AL_INSERTAR'); - END IF; - 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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterInsert` -AFTER INSERT ON `inter` FOR EACH ROW -BEGIN - REPLACE vn2008.Tickets_state(Id_Ticket, inter_id,state_name) - SELECT NEW.Id_Ticket, NEW.inter_id, s.`name` FROM vn2008.state s WHERE s.id = NEW.state_id; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterUpdate` -AFTER UPDATE ON `inter` FOR EACH ROW -BEGIN - DECLARE intIdTicket INT; - DECLARE intInterId INT; - DECLARE strName VARCHAR(15); - - IF (NEW.state_id <> OLD.state_id) THEN - REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name) - SELECT NEW.Id_Ticket, NEW.inter_id, s.`name` - FROM vn2008.state s WHERE s.id = NEW.state_id; - END IF; - IF (NEW.Id_Ticket <> OLD.Id_Ticket) THEN - - SELECT i.Id_Ticket, i.inter_id, s.`name` - INTO intIdTicket, intInterId, strName - FROM vncontrol.inter i - JOIN vn2008.state s ON i.state_id = s.id - WHERE Id_Ticket = NEW.Id_Ticket - ORDER BY odbc_date DESC - LIMIT 1; - IF intIdTicket > 0 THEN - REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name) - VALUES(intIdTicket, intInterId, strName); - END IF; - 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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterDelete` -AFTER DELETE ON `inter` FOR EACH ROW -BEGIN - DECLARE intIdTicket INT; - DECLARE intInterId INT; - DECLARE strName VARCHAR(15); - - DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' - BEGIN - DELETE FROM vn2008.Tickets_state - WHERE Id_Ticket = OLD.Id_Ticket; - END; - - IF OLD.odbc_date > TIMESTAMPADD(WEEK, -1, CURDATE()) THEN - - SELECT i.Id_Ticket, i.inter_id, s.`name` - INTO intIdTicket, intInterId, strName - FROM vncontrol.inter i - JOIN vn2008.state s ON i.state_id = s.id - WHERE Id_Ticket = OLD.Id_Ticket - ORDER BY odbc_date DESC - LIMIT 1; - - IF intIdTicket > 0 THEN - REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name) - VALUES (intIdTicket, intInterId, strName); - END IF; - - 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 */ ; - --- --- Dumping routines for database 'vncontrol' --- -/*!50003 DROP PROCEDURE IF EXISTS `clean` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN - - DECLARE v_date2 DATETIME DEFAULT TIMESTAMPADD(MONTH, -2,CURDATE()); - - INSERT INTO vncontrol.daily_task_log(state) VALUES('clean START'); - - DELETE FROM vncontrol.inter WHERE odbc_date <= v_date2; - - INSERT INTO vncontrol.daily_task_log(state) VALUES('clean END'); - -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 DROP PROCEDURE IF EXISTS `Resumen` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Resumen`() -BEGIN - -select accion, CodigoTrabajador, semana, Pedidos, Lineas -from accion -join -( - SELECT * FROM - ( - select count(*) as Pedidos, semana, Id_Trabajador, accion_id - from - (select distinct * - from - ( - select vn2008.semana(odbc_date) as semana - ,Id_Trabajador - ,accion_id - ,Id_Ticket - from vncontrol.inter - ) sub - ) sub2 - group by semana, Id_Trabajador, accion_id - ) subpedidos - - inner join - ( - - select semana, Id_Trabajador, accion_id, count(*) as Lineas - from vn2008.Movimientos - inner join - ( - select distinct vn2008.semana(odbc_date) as semana, Id_Ticket, Id_Trabajador, accion_id from vncontrol.inter - ) vnc using(Id_Ticket) - group by semana, Id_Trabajador, accion_id - - ) sublineas using(semana, Id_Trabajador, accion_id) - -) sub3 using(accion_id) - -join vn2008.Trabajadores using(Id_Trabajador) -; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Current Database: `edi` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `edi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; - -USE `edi`; - --- --- Table structure for table `batch` --- - -DROP TABLE IF EXISTS `batch`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `batch` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `message_id` int(10) unsigned NOT NULL, - `type_id` smallint(5) unsigned NOT NULL, - `buy_edi_id` int(10) DEFAULT NULL, +CREATE TABLE `account` ( + `id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), - KEY `type_id` (`type_id`,`buy_edi_id`), - KEY `message_id` (`message_id`), - KEY `buy_edi_id` (`buy_edi_id`), - CONSTRAINT `batch_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `batch_ibfk_2` FOREIGN KEY (`buy_edi_id`) REFERENCES `vn2008`.`buy_edi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `account_ibfk_3` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Users allowed to have an account'; /*!40101 SET character_set_client = @saved_cs_client */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`accountAfterInsert` + AFTER INSERT ON `account` + FOR EACH ROW +BEGIN + UPDATE user SET sync = FALSE + WHERE id = NEW.id; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`accountAfterDelete` + AFTER DELETE ON `account` + FOR EACH ROW +BEGIN + UPDATE user SET sync = FALSE + WHERE id = OLD.id; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Table structure for table `batch_type` +-- Table structure for table `accountConfig` -- -DROP TABLE IF EXISTS `batch_type`; +DROP TABLE IF EXISTS `accountConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `batch_type` ( - `id` mediumint(8) unsigned NOT NULL, - `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `bucket` --- - -DROP TABLE IF EXISTS `bucket`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `bucket` ( - `bucket_id` int(11) unsigned NOT NULL, - `bucket_type_id` mediumint(8) unsigned NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `x_size` mediumint(8) unsigned NOT NULL, - `y_size` mediumint(8) unsigned NOT NULL, - `z_size` mediumint(8) unsigned NOT NULL, - `entry_date` date DEFAULT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime DEFAULT NULL, - PRIMARY KEY (`bucket_id`), - KEY `group_id` (`y_size`), - KEY `plant_id` (`x_size`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/CK090916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `bucket_type` --- - -DROP TABLE IF EXISTS `bucket_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `bucket_type` ( - `bucket_type_id` mediumint(8) unsigned NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date DEFAULT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime DEFAULT NULL, - PRIMARY KEY (`bucket_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/FB090916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `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 `accountConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `log_mail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Mail where the log information is sent', - `presale_id` mediumint(8) unsigned DEFAULT NULL, - `default_kop` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `presale_id` (`presale_id`), - CONSTRAINT `config_ibfk_1` FOREIGN KEY (`presale_id`) REFERENCES `batch_type` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `feature` --- - -DROP TABLE IF EXISTS `feature`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `feature` ( - `item_id` int(11) unsigned NOT NULL, - `feature_type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `feature_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date NOT NULL, - `expiry_date` date NOT NULL, - `change_date_time` datetime NOT NULL, - PRIMARY KEY (`item_id`,`feature_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FF130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `file_config` --- - -DROP TABLE IF EXISTS `file_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `file_config` ( - `file_name` varchar(2) COLLATE utf8_unicode_ci NOT NULL, - `to_table` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `file` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `updated` date DEFAULT NULL, - PRIMARY KEY (`file_name`), - UNIQUE KEY `to_table` (`to_table`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ftp_config` --- - -DROP TABLE IF EXISTS `ftp_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ftp_config` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(255) CHARACTER SET utf8 NOT NULL, - `user` varchar(50) CHARACTER SET utf8 NOT NULL, - `password` varchar(50) CHARACTER SET utf8 NOT NULL, + `homedir` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The base folder for users home directories', + `shell` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The default shell', + `min` smallint(6) NOT NULL, + `max` smallint(6) NOT NULL, + `warn` smallint(6) NOT NULL, + `inact` smallint(6) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `genus` +-- Temporary table structure for view `accountDovecot` -- -DROP TABLE IF EXISTS `genus`; +DROP TABLE IF EXISTS `accountDovecot`; +/*!50001 DROP VIEW IF EXISTS `accountDovecot`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `accountDovecot` ( + `name` tinyint NOT NULL, + `password` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `accountLog` +-- + +DROP TABLE IF EXISTS `accountLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `genus` ( - `genus_id` mediumint(8) unsigned NOT NULL, - `latin_genus_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date DEFAULT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime DEFAULT NULL, - PRIMARY KEY (`genus_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `goodCharacteristic` --- - -DROP TABLE IF EXISTS `goodCharacteristic`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `goodCharacteristic` ( - `supplyResponse` varchar(26) COLLATE utf8_unicode_ci NOT NULL, - `type` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.type', - `value` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.value', - PRIMARY KEY (`supplyResponse`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `imap_config` --- - -DROP TABLE IF EXISTS `imap_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `imap_config` ( - `id` tinyint(3) unsigned NOT NULL, - `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost', - `user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `pass` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `clean_period` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'How long the old mails are preserved', - `success_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `error_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, +CREATE TABLE `accountLog` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `msg` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `rhost` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `time` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters'; +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `item` +-- Temporary table structure for view `accountPam` -- -DROP TABLE IF EXISTS `item`; +DROP TABLE IF EXISTS `accountPam`; +/*!50001 DROP VIEW IF EXISTS `accountPam`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `accountPam` ( + `name` tinyint NOT NULL, + `password` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ldapConfig` +-- + +DROP TABLE IF EXISTS `ldapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `item` ( - `id` int(11) unsigned NOT NULL, - `product_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `plant_id` mediumint(8) unsigned DEFAULT NULL, - `group_id` int(11) DEFAULT NULL, - `entry_date` date DEFAULT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `group_id` (`group_id`), - KEY `plant_id` (`plant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `item_feature` --- - -DROP TABLE IF EXISTS `item_feature`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `item_feature` ( - `item_id` int(11) NOT NULL, - `presentation_order` tinyint(11) unsigned NOT NULL, - `feature` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `regulation_type` tinyint(3) unsigned NOT NULL, - `entry_date` date NOT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime NOT NULL, - PRIMARY KEY (`item_id`,`presentation_order`,`entry_date`,`change_date_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FY130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `item_feature_bi` BEFORE INSERT ON `item_feature` FOR EACH ROW -BEGIN - IF NEW.expiry_date = '0000-00-00' THEN - SET NEW.expiry_date = NULL; - 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 */ ; - --- --- Table structure for table `item_group` --- - -DROP TABLE IF EXISTS `item_group`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `item_group` ( - `group_code` int(11) unsigned NOT NULL, - `dutch_group_description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date NOT NULL, - `expiry_date` date NOT NULL, - `change_date_time` datetime NOT NULL, - PRIMARY KEY (`group_code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FO130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `item_track` --- - -DROP TABLE IF EXISTS `item_track`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `item_track` ( - `item_id` int(10) unsigned NOT NULL, - `s1` tinyint(3) NOT NULL DEFAULT '0', - `s2` tinyint(3) NOT NULL DEFAULT '0', - `s3` tinyint(3) NOT NULL DEFAULT '0', - `s4` tinyint(3) NOT NULL DEFAULT '0', - `pac` tinyint(3) NOT NULL DEFAULT '0', - `cat` tinyint(3) NOT NULL DEFAULT '0', - `ori` tinyint(3) NOT NULL DEFAULT '0', - `pro` tinyint(3) NOT NULL DEFAULT '0', - `package` tinyint(3) NOT NULL DEFAULT '0', - `s5` tinyint(3) NOT NULL DEFAULT '0', - `s6` tinyint(3) NOT NULL DEFAULT '0', - `kop` tinyint(3) NOT NULL DEFAULT '0', - `sub` tinyint(3) NOT NULL DEFAULT '0', - PRIMARY KEY (`item_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mail` --- - -DROP TABLE IF EXISTS `mail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mail` ( +CREATE TABLE `ldapConfig` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `mail` varchar(150) COLLATE utf8_unicode_ci NOT NULL, - `kop` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `mail` (`mail`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; + `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The hostname of LDAP server', + `rdn` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The LDAP user', + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Base64 encoded password', + `baseDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN to do the query', + `filter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Filter to apply to the query', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `message` +-- Table structure for table `mailAlias` -- -DROP TABLE IF EXISTS `message`; +DROP TABLE IF EXISTS `mailAlias`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `message` ( +CREATE TABLE `mailAlias` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `sender_id` int(10) unsigned DEFAULT NULL, - `mail_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(50) CHARACTER SET utf8 NOT NULL, + `isPublic` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `alias` (`alias`) +) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail aliases'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mailAliasAccount` +-- + +DROP TABLE IF EXISTS `mailAliasAccount`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mailAliasAccount` ( + `mailAlias` int(10) unsigned NOT NULL, + `account` int(10) unsigned NOT NULL, + PRIMARY KEY (`mailAlias`,`account`), + KEY `account` (`account`), + CONSTRAINT `account` FOREIGN KEY (`account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `mailAlias` FOREIGN KEY (`mailAlias`) REFERENCES `mailAlias` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail alias that is assigned to each account'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mailConfig` +-- + +DROP TABLE IF EXISTS `mailConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mailConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mailForward` +-- + +DROP TABLE IF EXISTS `mailForward`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mailForward` ( + `account` int(10) unsigned NOT NULL, + `forwardTo` varchar(250) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`account`), + CONSTRAINT `mailForward_ibfk_1` FOREIGN KEY (`account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail forwarding'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `role` +-- + +DROP TABLE IF EXISTS `role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `role` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(14) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `hasLogin` tinyint(3) unsigned NOT NULL DEFAULT '0', `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), - UNIQUE KEY `mail_id` (`mail_id`), - KEY `sender_id` (`sender_id`), - CONSTRAINT `message_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Roles'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `param` +-- Table structure for table `roleInherit` -- -DROP TABLE IF EXISTS `param`; +DROP TABLE IF EXISTS `roleInherit`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `param` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(5) COLLATE utf8_unicode_ci NOT NULL, - `subname` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `position` tinyint(3) unsigned NOT NULL DEFAULT '1', - `type` enum('INTEGER','DOUBLE','STRING','DATE','TIME') COLLATE utf8_unicode_ci NOT NULL, - `required` tinyint(3) unsigned NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`,`subname`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; +CREATE TABLE `roleInherit` ( + `role` int(10) unsigned NOT NULL, + `inheritsFrom` int(10) unsigned NOT NULL, + PRIMARY KEY (`role`,`inheritsFrom`), + KEY `owner_id` (`inheritsFrom`), + CONSTRAINT `roleInherit_ibfk_1` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `roleInherit_ibfk_2` FOREIGN KEY (`inheritsFrom`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Role inheritance'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `plant` +-- Table structure for table `roleRole` -- -DROP TABLE IF EXISTS `plant`; +DROP TABLE IF EXISTS `roleRole`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `plant` ( - `plant_id` mediumint(8) unsigned NOT NULL, - `genus_id` mediumint(8) unsigned NOT NULL, - `specie_id` mediumint(8) unsigned DEFAULT NULL, - `entry_date` date DEFAULT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime DEFAULT NULL, - PRIMARY KEY (`plant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FT130916.txt'; +CREATE TABLE `roleRole` ( + `role` int(10) unsigned NOT NULL, + `inheritsFrom` int(10) unsigned NOT NULL, + UNIQUE KEY `role` (`role`,`inheritsFrom`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Calculated role inheritance'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `specie` +-- Table structure for table `sambaConfig` -- -DROP TABLE IF EXISTS `specie`; +DROP TABLE IF EXISTS `sambaConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `specie` ( - `specie_id` mediumint(8) unsigned NOT NULL, - `genus_id` mediumint(8) unsigned NOT NULL, - `latin_species_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date DEFAULT NULL, - `expiry_date` date DEFAULT NULL, - `change_date_time` datetime DEFAULT NULL, - PRIMARY KEY (`specie_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FS130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `supplier` --- - -DROP TABLE IF EXISTS `supplier`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplier` ( - `supplier_id` int(10) unsigned NOT NULL COMMENT 'FHRegistrationNr', - `glnAddressCode` varchar(13) CHARACTER SET utf8 DEFAULT NULL, - `company_name` varchar(70) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date NOT NULL, - `expiry_date` date NOT NULL, - `change_date_time` datetime NOT NULL, - PRIMARY KEY (`supplier_id`), - KEY `glnaddressCodeidx` (`glnAddressCode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/FEC010104/CC090916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `supplyResponse` --- - -DROP TABLE IF EXISTS `supplyResponse`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplyResponse` ( - `id` varchar(26) COLLATE utf8_unicode_ci NOT NULL, - `marketPlace` varchar(13) COLLATE utf8_unicode_ci NOT NULL, - `imageReference` varchar(2048) COLLATE utf8_unicode_ci DEFAULT NULL, - `supplierParty` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'company GLN code', - `productVnhCode` varchar(7) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Industry Assigned Id', - `productDescription` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` int(8) DEFAULT NULL, - `incrementalOrderableQuantity` int(8) DEFAULT NULL, - `chargeAmount` decimal(10,2) DEFAULT NULL, - `unitCode` tinyint(2) unsigned DEFAULT NULL, - `packageQuantity` int(8) DEFAULT NULL, - `earliestDespatch` datetime DEFAULT NULL, - `latestDelivery` datetime DEFAULT NULL, +CREATE TABLE `sambaConfig` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `host` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The hosname of Samba server', + `sshUser` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The SSH user to connect to servers', + `sshPass` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The SSH password base64 encoded', + `uidBase` int(10) unsigned NOT NULL DEFAULT '10000' COMMENT 'The base for Unix uids', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `type` +-- Table structure for table `user` -- -DROP TABLE IF EXISTS `type`; +DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `type` ( - `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `type_group_id` tinyint(3) unsigned NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date NOT NULL, - `expiry_date` date NOT NULL, - `change_date_time` datetime NOT NULL, - PRIMARY KEY (`type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FE130916.txt'; +CREATE TABLE `user` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) CHARACTER SET utf8 NOT NULL, + `nickname` varchar(127) COLLATE utf8_unicode_ci NOT NULL, + `password` char(64) COLLATE utf8_unicode_ci NOT NULL, + `role` int(10) unsigned NOT NULL DEFAULT '2', + `active` tinyint(1) NOT NULL DEFAULT '1', + `email` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `lang` char(2) CHARACTER SET utf8 DEFAULT NULL, + `sync` tinyint(4) NOT NULL DEFAULT '0', + `recoverPass` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lastPassChange` datetime DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`), + KEY `role` (`role`), + KEY `email` (`email`), + KEY `nickname` (`nickname`), + KEY `lang` (`lang`), + CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=102551 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; /*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `value` --- - -DROP TABLE IF EXISTS `value`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `value` ( - `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `type_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `type_description` varchar(70) COLLATE utf8_unicode_ci NOT NULL, - `entry_date` date NOT NULL, - `expiry_date` date NOT NULL, - `change_date_time` datetime NOT NULL, - PRIMARY KEY (`type_id`,`type_value`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FV130916.txt'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping routines for database 'edi' --- -/*!50003 DROP PROCEDURE IF EXISTS `batchNew` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -834,190 +331,17 @@ CREATE TABLE `value` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `batchNew`( - vMessage INT - ,vItem VARCHAR(255) - ,vType MEDIUMINT - ,vDeliveryNumber BIGINT - ,vDate DATE - ,vHour TIME - ,vRef INT - ,vAgj INT - ,vCat VARCHAR(2) - ,vPac INT - ,vSub MEDIUMINT - ,vKop INT - ,vPtd VARCHAR(6) - ,vPro MEDIUMINT - ,vOrigin VARCHAR(3) - ,vPtj MEDIUMINT - ,vQuantiy INT - ,vPrice DOUBLE - ,vClock SMALLINT - ,vS1 VARCHAR(3) - ,vS2 VARCHAR(3) - ,vS3 VARCHAR(3) - ,vS4 VARCHAR(4) - ,vS5 VARCHAR(3) - ,vS6 VARCHAR(3) - ,vK1 SMALLINT - ,vK2 SMALLINT - ,vP1 TINYINT - ,vP2 TINYINT - ,vAuction SMALLINT - ,vPackage INT -) +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`userBeforeInsert` + BEFORE INSERT ON `user` + FOR EACH ROW BEGIN -/** - * Añade un nuevo lote, genera su código de barras y - * inserta/actualiza el registro en la tabla #vn2008.buy_edi - */ - DECLARE vEdi INT; - DECLARE vRewriteKop INT DEFAULT NULL; - DECLARE vBarcode CHAR(15) DEFAULT NULL; - DECLARE vIsDuplicated BOOLEAN DEFAULT FALSE; - DECLARE vUpdateExistent BOOLEAN DEFAULT FALSE; - - DECLARE CONTINUE HANDLER FOR 1062 -- ER_DUP_KEY - SET vIsDuplicated = TRUE; - - -- Genera el código de barras - - IF vAgj != 0 AND vAgj IS NOT NULL - THEN - SET vBarcode = CONCAT( - LPAD(vAuction, 2, 0), - LPAD(IFNULL(vClock, 99), 2, 0), - LPAD(DAYOFYEAR(vDate), 3, 0), - IF(vClock IS NULL OR vClock = 99, - LPAD(vAgj, 7, 0), - CONCAT(LPAD(vAgj, 5, 0), '01') - ), - '0' - ); - END IF; - - -- Reescribe el parámetro kop - - IF vKop IS NULL - THEN - SELECT default_kop INTO vKop FROM config; - END IF; - - SELECT e.kop INTO vRewriteKop - FROM mail e - JOIN message m ON m.sender_id = e.id - WHERE m.id = vMessage; - - SET vKop = IFNULL(vRewriteKop, vKop); - - -- Inserta el nuevo EKT - - INSERT INTO vn2008.buy_edi SET - barcode = IFNULL(vBarcode, barcode) - ,delivery_number = vDeliveryNumber - ,entry_year = YEAR(vDate) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k01 = vK1 - ,k02 = vK2 - ,k03 = vP1 - ,k04 = vP2 - ,auction = vAuction - ,package = vPackage; - - - -- Si el EKT está duplicado y el que habia en la tabla era uno - -- provisional, lo actualiza con los nuevos valores. - - IF NOT vIsDuplicated - THEN - SET vEdi = LAST_INSERT_ID(); - CALL ediLoad (vEdi); - - ELSEIF vDeliveryNumber != 0 - AND vDeliveryNumber IS NOT NULL - THEN - SELECT id INTO vEdi - FROM vn2008.buy_edi - WHERE delivery_number = vDeliveryNumber; - - SELECT COUNT(*) = 0 INTO vUpdateExistent - FROM vn2008.buy_edi e - JOIN batch b ON b.buy_edi_id = e.id - JOIN config c - WHERE e.delivery_number = vDeliveryNumber - AND b.type_id != c.presale_id; - END IF; - - IF vUpdateExistent - THEN - UPDATE vn2008.buy_edi SET - barcode = IFNULL(vBarcode, barcode) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k01 = vK1 - ,k02 = vK2 - ,k03 = vP1 - ,k04 = vP2 - ,auction = vAuction - ,package = vPackage - WHERE id = vEdi; - END IF; - - -- Registra el lote - - INSERT INTO batch SET - message_id = vMessage - ,type_id = vType - ,buy_edi_id = vEdi; -END ;; + CALL userCheckName (NEW.`name`); +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 DROP PROCEDURE IF EXISTS `ediLoad` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -1027,165 +351,27 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ediLoad`(vEdi INT) +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`userBeforeUpdate` + BEFORE UPDATE ON `user` + FOR EACH ROW BEGIN - DECLARE vRef INT; - DECLARE vBuy INT; - DECLARE vItem INT; - DECLARE vQty INT; - DECLARE vPackage INT; - DECLARE vIsLot BOOLEAN; - - -- Carga los datos necesarios del EKT - - SELECT ref, qty, package INTO vRef, vQty, vPackage - FROM vn2008.buy_edi e - LEFT JOIN item i ON e.ref = i.id - WHERE e.id = vEdi; - - -- Inserta el cubo si no existe - - IF vPackage = 800 - THEN - SET vPackage = 800 + vQty; - - INSERT IGNORE INTO vn2008.Cubos SET - Id_Cubo = vPackage, - x = 7200 / vQty, - y = 1; - ELSE - INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) - SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) - FROM bucket WHERE bucket_id = vPackage; - - IF ROW_COUNT() > 0 - THEN - INSERT INTO vn2008.mail SET - `subject` = 'Cubo añadido', - `text` = CONCAT('Se ha añadido el cubo: ', vPackage), - `to` = 'ekt@verdnatura.es'; - END IF; + IF NOT (NEW.`name` <=> OLD.`name`) THEN + CALL userCheckName (NEW.`name`); END IF; - -- Intenta obtener el artículo en base a los atributos holandeses - - INSERT IGNORE INTO item_track SET - item_id = vRef; - - SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem - FROM vn2008.buy_edi e - JOIN item_track t ON t.item_id = e.ref - LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref - LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id - JOIN vn2008.config cfg - WHERE e.id = vEdi - AND l.id != vEdi - AND c.Id_Article != cfg.generic_item - 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) - AND IF(t.s4, l.s4 = e.s4, TRUE) - AND IF(t.s5, l.s5 = e.s5, TRUE) - AND IF(t.s6, l.s6 = e.s6, TRUE) - AND IF(t.kop, l.kop = e.kop, TRUE) - AND IF(t.pac, l.pac = e.pac, TRUE) - AND IF(t.cat, l.cat = e.cat, TRUE) - AND IF(t.ori, l.ori = e.ori, TRUE) - AND IF(t.pro, l.pro = e.pro, TRUE) - AND IF(t.sub, l.sub = e.sub, TRUE) - AND IF(t.package, l.package = e.package, TRUE) - AND c.Id_Article < 170000 - ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; - - -- Determina si el articulo se vende por lotes - - IF vItem - THEN - SELECT COUNT(*) > 0 INTO vIsLot - FROM vn2008.Articles a - LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE a.Id_Article = vItem - AND t.`transaction`; - - -- Si el articulo se vende por lotes se inserta un nuevo artículo - - IF vIsLot - THEN - INSERT INTO vn2008.Articles ( - Article - ,Medida - ,Categoria - ,Id_Origen - ,iva_group_id - ,Foto - ,Color - ,Codintrastat - ,tipo_id - ,Tallos - ) - SELECT - i.`name` - ,IFNULL(e.s1, e.pac) - ,e.cat - ,IFNULL(o.id, 17) - ,IFNULL(a.iva_group_id, 1) - ,a.Foto - ,a.Color - ,a.Codintrastat - ,IFNULL(a.tipo_id, 10) - ,IF(a.tipo_id = 15, 0, 1) - FROM vn2008.buy_edi e - LEFT JOIN item i ON i.id = e.ref - LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori - LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem - WHERE e.id = vEdi; - - SET vItem = LAST_INSERT_ID(); - END IF; + IF NOT (NEW.`password` <=> OLD.`password`) THEN + SET NEW.lastPassChange = NOW(); END IF; - -- Inserta la compra asociada al EKT - - INSERT INTO vn2008.Compres - ( - Id_Entrada - ,buy_edi_id - ,Costefijo - ,Id_Article - ,grouping - ,caja - ,Packing - ,Cantidad - ,Productor - ,Etiquetas - ,Id_Cubo - ) - SELECT - cfg.edi_entry - ,vEdi - ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri - ,IFNULL(vItem, cfg.generic_item) - ,IFNULL(c.grouping, e.pac) - ,IFNULL(c.caja, TRUE) - ,@pac := e.pac / @t - ,@pac * e.qty - ,s.company_name - ,e.qty - ,IFNULL(c.Id_Cubo, e.package) - FROM vn2008.buy_edi e - LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy - LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN supplier s ON e.pro = s.supplier_id - JOIN vn2008.config cfg - WHERE e.id = vEdi - LIMIT 1; -END ;; + IF NEW.`sync` <=> OLD.`sync` THEN + SET NEW.`sync` = FALSE; + 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 DROP PROCEDURE IF EXISTS `messageNew` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -1195,216 +381,163 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `messageNew`( - vMailId VARCHAR(100) - ,vSender VARCHAR(150) - ,OUT vMessageId INT -) +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `userAfterUpdate` + AFTER UPDATE ON `user` + FOR EACH ROW +BEGIN + IF NOT (NEW.`role` <=> OLD.`role`) + THEN + INSERT INTO vn2008.mail SET + `to` = 'jgallego@verdnatura.es', + `reply_to` = 'jgallego@verdnatura.es', + `subject` = 'Rol modificado', + `text` = CONCAT(account.userGetName(), ' ha modificado el rol del usuario ', + NEW.`name`, ' de ', OLD.role, ' a ', NEW.role); + 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 */ ; + +-- +-- Table structure for table `userConfig` +-- + +DROP TABLE IF EXISTS `userConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `loginKey` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `userPassword` +-- + +DROP TABLE IF EXISTS `userPassword`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userPassword` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `length` tinyint(3) unsigned NOT NULL, + `nAlpha` tinyint(3) unsigned NOT NULL, + `nUpper` tinyint(3) unsigned NOT NULL, + `nDigits` tinyint(3) unsigned NOT NULL, + `nPunct` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Restrictions on user passwords'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `userRole` +-- + +DROP TABLE IF EXISTS `userRole`; +/*!50001 DROP VIEW IF EXISTS `userRole`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `userRole` ( + `id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `userView` +-- + +DROP TABLE IF EXISTS `userView`; +/*!50001 DROP VIEW IF EXISTS `userView`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `userView` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `active` tinyint NOT NULL, + `email` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `lang` tinyint NOT NULL, + `role` tinyint NOT NULL, + `recoverPass` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping events for database 'account' +-- + +-- +-- Dumping routines for database 'account' +-- +/*!50003 DROP FUNCTION IF EXISTS `passwordGenerate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `passwordGenerate`() RETURNS text CHARSET utf8 BEGIN /** - * Registra un correo electronico. + * Genera una contraseña aleatoria + * cumpliendo los requisitos mínimos. * - * @param vMailId Message-ID del correo electrónico - * @param vSender Id del correo electrónio del remitente + * @return Generated password */ - DECLARE vSenderId INT; - - SELECT id INTO vSenderId FROM mail - WHERE mail = vSender; - - INSERT IGNORE INTO message SET - sender_id = vSenderId - ,mail_id = vMailId; - - SET vMessageId = LAST_INSERT_ID(); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `__batch_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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `__batch_new`( - v_message INT - ,v_type MEDIUMINT - ,v_delivery_number BIGINT - ,v_fec DATE - ,v_hor TIME - ,v_ref INT - ,v_agj INT - ,v_cat VARCHAR(2) - ,v_pac INT - ,v_sub MEDIUMINT - ,v_kop INT - ,v_ptd VARCHAR(6) - ,v_pro MEDIUMINT - ,v_ori VARCHAR(3) - ,v_ptj MEDIUMINT - ,v_qty INT - ,v_pri DOUBLE - ,v_klo SMALLINT - ,v_s1 VARCHAR(3) - ,v_s2 VARCHAR(3) - ,v_s3 VARCHAR(3) - ,v_s4 VARCHAR(4) - ,v_s5 VARCHAR(3) - ,v_s6 VARCHAR(3) - ,v_k1 SMALLINT - ,v_k2 SMALLINT - ,v_p1 TINYINT - ,v_p2 TINYINT - ,v_auction SMALLINT - ,v_package INT -) -BEGIN -/** - * Añade un nuevo lote, genera su código de barras y - * inserta/actualiza el registro en la tabla #vn2008.buy_edi - **/ - - DECLARE v_edi INT; - DECLARE v_barcode CHAR(15) DEFAULT NULL; - DECLARE v_is_duplicated BOOLEAN DEFAULT FALSE; - DECLARE v_update_existent BOOLEAN DEFAULT FALSE; - - DECLARE CONTINUE HANDLER FOR 1062 -- ER_DUP_KEY - SET v_is_duplicated = TRUE; - - -- Genera el código de barras - - IF v_agj != 0 AND v_agj IS NOT NULL - THEN - SET v_barcode = CONCAT( - LPAD(v_auction, 2, 0), - LPAD(IFNULL(v_klo, 99), 2, 0), - LPAD(DAYOFYEAR(v_fec), 3, 0), - IF(v_klo IS NULL OR v_klo = 99, - LPAD(v_agj, 7, 0), - CONCAT(LPAD(v_agj, 5, 0), '01') - ), - '0' - ); - END IF; + DECLARE vMinLength TINYINT(3); + DECLARE vMinAlpha TINYINT(3); + DECLARE vMinUpper TINYINT(3); + DECLARE vMinDigits TINYINT(3); + DECLARE vMinPunct TINYINT(3); + DECLARE vAlpha TINYINT(3) DEFAULT 0; + DECLARE vUpper TINYINT(3) DEFAULT 0; + DECLARE vDigits TINYINT(3) DEFAULT 0; + DECLARE vPunct TINYINT(3) DEFAULT 0; + DECLARE vRandIndex INT; + DECLARE vPwd TEXT DEFAULT ''; - IF v_kop IS NULL - THEN - SELECT default_kop INTO v_kop FROM config; - END IF; + DECLARE vAlphaChars TEXT DEFAULT 'abcdefghijklmnopqrstuvwxyz'; + DECLARE vUpperChars TEXT DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + DECLARE vDigitChars TEXT DEFAULT '1234567890'; + DECLARE vPunctChars TEXT DEFAULT '!$%&()=.'; + + SELECT length, nAlpha, nUpper, nDigits, nPunct + INTO vMinLength, vMinAlpha, vMinUpper, vMinDigits, vMinPunct FROM userPassword; + + WHILE LENGTH(vPwd) < vMinLength OR vAlpha < vMinAlpha + OR vUpper < vMinUpper OR vDigits < vMinDigits OR vPunct < vMinPunct DO + SET vRandIndex = FLOOR((RAND() * 4) + 1); - -- Inserta el nuevo EKT - - INSERT INTO vn2008.buy_edi SET - barcode = IFNULL(v_barcode, barcode) - ,delivery_number = v_delivery_number - ,entry_year = YEAR(v_fec) - ,fec = v_fec - ,hor = v_hor - ,ref = v_ref - ,agj = v_agj - ,cat = v_cat - ,pac = v_pac - ,sub = v_sub - ,kop = v_kop - ,ptd = v_ptd - ,pro = v_pro - ,ori = v_ori - ,ptj = v_ptj - ,qty = v_qty - ,pri = v_pri - ,klo = v_klo - ,s1 = v_s1 - ,s2 = v_s2 - ,s3 = v_s3 - ,s4 = v_s4 - ,s5 = v_s5 - ,s6 = v_s6 - ,k01 = v_k1 - ,k02 = v_k2 - ,k03 = v_p1 - ,k04 = v_p2 - ,auction = v_auction - ,package = v_package; - - - -- Si el EKT está duplicado y el que habia en la tabla era uno - -- provisional, lo actualiza con los nuevos valores. - - IF NOT v_is_duplicated - THEN - SET v_edi = LAST_INSERT_ID(); - CALL edi_load (v_edi); - - ELSEIF v_delivery_number != 0 - AND v_delivery_number IS NOT NULL - THEN - SELECT id INTO v_edi - FROM vn2008.buy_edi - WHERE delivery_number = v_delivery_number; - - SELECT COUNT(*) = 0 INTO v_update_existent - FROM vn2008.buy_edi e - JOIN batch b ON b.buy_edi_id = e.id - JOIN config c - WHERE e.delivery_number = v_delivery_number - AND b.type_id != c.presale_id; - END IF; - - IF v_update_existent - THEN - UPDATE vn2008.buy_edi SET - barcode = IFNULL(v_barcode, barcode) - ,fec = v_fec - ,hor = v_hor - ,ref = v_ref - ,agj = v_agj - ,cat = v_cat - ,pac = v_pac - ,sub = v_sub - ,kop = v_kop - ,ptd = v_ptd - ,pro = v_pro - ,ori = v_ori - ,ptj = v_ptj - ,qty = v_qty - ,pri = v_pri - ,klo = v_klo - ,s1 = v_s1 - ,s2 = v_s2 - ,s3 = v_s3 - ,s4 = v_s4 - ,s5 = v_s5 - ,s6 = v_s6 - ,k01 = v_k1 - ,k02 = v_k2 - ,k03 = v_p1 - ,k04 = v_p2 - ,auction = v_auction - ,package = v_package - WHERE id = v_edi; - END IF; - - -- Registra el lote - - INSERT INTO batch SET - message_id = v_message - ,type_id = v_type - ,buy_edi_id = v_edi; + CASE + WHEN vRandIndex = 1 THEN + SET vPwd = CONCAT(vPwd, SUBSTRING(vAlphaChars, FLOOR((RAND() * 26) + 1), 1)); + SET vAlpha = vAlpha + 1; + WHEN vRandIndex = 2 THEN + SET vPwd = CONCAT(vPwd, SUBSTRING(vUpperChars, FLOOR((RAND() * 26) + 1), 1)); + SET vUpper = vUpper + 1; + WHEN vRandIndex = 3 THEN + SET vPwd = CONCAT(vPwd, SUBSTRING(vDigitChars, FLOOR((RAND() * 10) + 1), 1)); + SET vDigits = vDigits + 1; + WHEN vRandIndex = 4 THEN + SET vPwd = CONCAT(vPwd, SUBSTRING(vPunctChars, FLOOR((RAND() * LENGTH(vPunctChars)) + 1), 1)); + SET vPunct = vPunct + 1; + END CASE; + END WHILE; +RETURN vPwd; 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 DROP PROCEDURE IF EXISTS `__edi_load` */; +/*!50003 DROP FUNCTION IF EXISTS `toUnixDays` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -1414,203 +547,1656 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `__edi_load`(v_edi INT) -BEGIN - DECLARE v_ref INT; - DECLARE v_buy INT; - DECLARE v_item INT; - DECLARE v_qty INT; - DECLARE v_package INT; - DECLARE v_is_lot BOOLEAN; - - -- Carga los datos necesarios del EKT - - SELECT ref, qty, package INTO v_ref, v_qty, v_package - FROM vn2008.buy_edi e - LEFT JOIN item i ON e.ref = i.id - WHERE e.id = v_edi; - - -- Inserta el cubo si no existe - - IF v_package = 800 - THEN - SET v_package = 800 + v_qty; - - INSERT IGNORE INTO vn2008.Cubos SET - Id_Cubo = v_package, - x = 7200 / v_qty, - y = 1; - ELSE - INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) - SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) - FROM bucket WHERE bucket_id = v_package; - - IF ROW_COUNT() > 0 - THEN - INSERT INTO vn2008.mail SET - `subject` = 'Cubo añadido', - `text` = CONCAT('Se ha añadido el cubo: ', v_package), - `to` = 'ekt@verdnatura.es'; - END IF; - END IF; - - -- Intenta obtener el artículo en base a los atributos holandeses - - INSERT IGNORE INTO item_track SET - item_id = v_ref; - - SELECT c.Id_Compra, c.Id_Article INTO v_buy, v_item - FROM vn2008.buy_edi e - JOIN item_track t ON t.item_id = e.ref - LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref - LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id - JOIN vn2008.config cfg - WHERE e.id = v_edi - AND l.id != v_edi - AND c.Id_Article != cfg.generic_item - 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) - AND IF(t.s4, l.s4 = e.s4, TRUE) - AND IF(t.s5, l.s5 = e.s5, TRUE) - AND IF(t.s6, l.s6 = e.s6, TRUE) - AND IF(t.kop, l.kop = e.kop, TRUE) - AND IF(t.pac, l.pac = e.pac, TRUE) - AND IF(t.cat, l.cat = e.cat, TRUE) - AND IF(t.ori, l.ori = e.ori, TRUE) - AND IF(t.pro, l.pro = e.pro, TRUE) - AND IF(t.sub, l.sub = e.sub, TRUE) - AND IF(t.package, l.package = e.package, TRUE) - AND c.Id_Article < 170000 - ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; - - -- Determina si el articulo se vende por lotes - - IF v_item - THEN - SELECT COUNT(*) > 0 INTO v_is_lot - FROM vn2008.Articles a - LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE a.Id_Article = v_item - AND t.`transaction`; - - -- Si el articulo se vende por lotes se inserta un nuevo artículo - - IF v_is_lot - THEN - INSERT INTO vn2008.Articles ( - Article - ,Medida - ,Categoria - ,Id_Origen - ,iva_group_id - ,Foto - ,Color - ,Codintrastat - ,tipo_id - ,Tallos - ) - SELECT - i.`name` - ,IFNULL(e.s1, e.pac) - ,e.cat - ,IFNULL(o.id, 17) - ,IFNULL(a.iva_group_id, 1) - ,a.Foto - ,a.Color - ,a.Codintrastat - ,IFNULL(a.tipo_id, 10) - ,IF(a.tipo_id = 15, 0, 1) - FROM vn2008.buy_edi e - LEFT JOIN item i ON i.id = e.ref - LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori - LEFT JOIN vn2008.Articles a ON a.Id_Article = v_item - WHERE e.id = v_edi; - - SET v_item = LAST_INSERT_ID(); - END IF; - END IF; - - -- Inserta la compra asociada al EKT - - INSERT INTO vn2008.Compres - ( - Id_Entrada - ,buy_edi_id - ,Costefijo - ,Id_Article - ,grouping - ,caja - ,Packing - ,Cantidad - ,Productor - ,Etiquetas - ,Id_Cubo - ) - SELECT - cfg.edi_entry - ,v_edi - ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri - ,IFNULL(v_item, cfg.generic_item) - ,IFNULL(c.grouping, e.pac) - ,IFNULL(c.caja, TRUE) - ,@pac := e.pac / @t - ,@pac * e.qty - ,s.company_name - ,e.qty - ,IFNULL(c.Id_Cubo, e.package) - FROM vn2008.buy_edi e - LEFT JOIN vn2008.Compres c ON c.Id_Compra = v_buy - LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN supplier s ON e.pro = s.supplier_id - JOIN vn2008.config cfg - WHERE e.id = v_edi - LIMIT 1; -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 DROP PROCEDURE IF EXISTS `__message_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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `__message_new`( - v_mail_id VARCHAR(100) - ,v_sender VARCHAR(150) - ,OUT v_message_id INT -) +CREATE DEFINER=`root`@`%` FUNCTION `toUnixDays`(vDate DATE) RETURNS int(11) + DETERMINISTIC BEGIN /** - * Registra un correo electronico. + * Devuelve el timestamp unix en días de una fecha. * - * @param v_mail_id Message-ID del correo electrónico - * @param v_sender Id del correo electrónio del remitente - **/ + * @param vData La fecha + * @return Unix timestamp en días + */ + RETURN UNIX_TIMESTAMP(vDate) DIV 86400; +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 DROP FUNCTION IF EXISTS `userCheckLogin` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `userCheckLogin`() RETURNS tinyint(1) + READS SQL DATA + DETERMINISTIC +BEGIN +/** + * Checks that variables @userId and @userName haven't been altered. + * + * @return %TRUE if they are unaltered or unset, otherwise %FALSE + */ + DECLARE vSignature VARCHAR(128); + DECLARE vKey VARCHAR(255); + + IF @userId IS NOT NULL + AND @userName IS NOT NULL + AND @userSignature IS NOT NULL + THEN + SELECT loginKey INTO vKey FROM userConfig; + SET vSignature = util.hmacSha2(256, CONCAT_WS('/', @userId, @userName), vKey); + RETURN vSignature = @userSignature; + END IF; + + RETURN FALSE; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `userGetId` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `USERGETID`() RETURNS int(11) + READS SQL DATA + DETERMINISTIC +BEGIN +/** + * Returns the current user id. + * + * @return The user id + */ + DECLARE vUser INT DEFAULT NULL; + + IF userCheckLogin() + THEN + SET vUser = @userId; + ELSE + SELECT id INTO vUser FROM user + WHERE name = LEFT(USER(), INSTR(USER(), '@') - 1); + END IF; + + RETURN vUser; +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 DROP FUNCTION IF EXISTS `userGetMysqlRole` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `userGetMysqlRole`(vUserName VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 +BEGIN +/** + * A partir de un nombre de usuario devuelve el rol + * de MySQL asociado y con el que deberia autenticarse + * cuando se utilice sistemas de autenticación externos. + * + * @param vUserName El nombre de usuario + * @return El rol de MySQL asociado + */ + DECLARE vRole VARCHAR(255); + + SELECT CONCAT(IF(r.hasLogin, 'z-', ''), r.name) INTO vRole + FROM role r + JOIN user u ON u.role = r.id + WHERE u.name = vUserName; + + RETURN vRole; +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 DROP FUNCTION IF EXISTS `userGetName` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `userGetName`() RETURNS varchar(30) CHARSET utf8 + NO SQL + DETERMINISTIC +BEGIN +/** + * Returns the current user name. + * + * @return The user name + */ + DECLARE vUser VARCHAR(30) DEFAULT NULL; + + IF userCheckLogin() + THEN + SET vUser = @userName; + ELSE + SET vUser = LEFT(USER(), INSTR(USER(), '@') - 1); + END IF; + + RETURN vUser; +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 DROP FUNCTION IF EXISTS `userGetNameFromId` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `userGetNameFromId`(vId INT) RETURNS varchar(30) CHARSET utf8 +BEGIN +/** + * Obtener nombre de usuari a partir de su id + * + * @param vId Id del usuario + * @return Nombre de usuario + */ + DECLARE vName VARCHAR(30); + + SELECT `name` INTO vName + FROM user + WHERE id = vId; + + RETURN vName; +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 DROP FUNCTION IF EXISTS `userHasRole` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `userHasRole`(vRoleName VARCHAR(255)) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** + * Comprueba si el usuario actual tiene asociado un rol. + * + * @param vRoleName Nombre del rol a comprobar + * @return %TRUE si tiene el rol, %FALSE en caso contrario + */ + DECLARE vRoleId INT; - DECLARE v_sender_id INT; - - SELECT id INTO v_sender_id FROM mail - WHERE mail = v_sender; - - INSERT IGNORE INTO message SET - sender_id = v_sender_id - ,mail_id = v_mail_id; + SELECT id INTO vRoleId + FROM role + WHERE `name` = vRoleName COLLATE 'utf8_unicode_ci'; - SET v_message_id = LAST_INSERT_ID(); + RETURN userHasRoleId (vRoleId); 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 DROP FUNCTION IF EXISTS `userHasRoleId` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `userHasRoleId`(vRoleId INT) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** + * Comprueba si el usuario actual tiene asociado un rol. + * + * @param vRoleId Identificador del rol a comprobar + * @return %TRUE si tiene el rol, %FALSE en caso contrario + */ + DECLARE vHasRole BOOL DEFAULT FALSE; + + SELECT COUNT(*) > 0 INTO vHasRole + FROM userRole + WHERE id = vRoleId; + + RETURN vHasRole; +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 DROP PROCEDURE IF EXISTS `privSync` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `privSync`() +proc: BEGIN +/** + * Sincroniza los permisos de los usuarios 'rol' de MySQL + * en base a la jerarquía de roles. Los usuarios rol resultantes + * de la mezcla de permisos serán nombrados singuiendo el patrón + * z-[nombre_rol]. + * + * Para que el procedimiento funcione debe de existir un usuario + * any@% que se usara como plantilla base. + * + * ¡Atención! Este procedimiento solo debe ser llamado cuando se + * modifiquen los privilegios de MySQL. Si se modifica la jerarquía + * de roles, se debe llamar al procedimiento roleSync() que llama a + * este internamente. + */ + DECLARE vTplUser VARCHAR(255) DEFAULT 'any'; + DECLARE vHost VARCHAR(255) DEFAULT '%'; + DECLARE vPrefix VARCHAR(2) DEFAULT 'z-'; + + DECLARE vTplExists BOOL; + DECLARE vTplHost VARCHAR(255); + DECLARE vPrefixedLike VARCHAR(255); + + -- Comprueba que el usuario plantilla existe + + SELECT COUNT(*) > 0, `Host` + INTO vTplExists, vTplHost + FROM mysql.user + WHERE `User` = vTplUser + LIMIT 1; + + IF NOT vTplExists THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'TEMPLATE_USER_NOT_EXISTS'; + END IF; + + -- Borra todos los privilegios calculados + + SET vPrefixedLike = CONCAT(vPrefix, '%'); + + DELETE FROM mysql.user + WHERE `User` LIKE vPrefixedLike; + + DELETE FROM mysql.db + WHERE `User` LIKE vPrefixedLike; + + DELETE FROM mysql.tables_priv + WHERE `User` LIKE vPrefixedLike; + + DELETE FROM mysql.columns_priv + WHERE `User` LIKE vPrefixedLike; + + DELETE FROM mysql.procs_priv + WHERE `User` LIKE vPrefixedLike; + + DELETE FROM mysql.proxies_priv + WHERE `Proxied_user` LIKE vPrefixedLike; + + -- Tablas temporales + + DROP TEMPORARY TABLE IF EXISTS tRole; + CREATE TEMPORARY TABLE tRole + ENGINE = MEMORY + SELECT + `name` role, + CONCAT(vPrefix, `name`) prefixedRole + FROM role + WHERE hasLogin; + + DROP TEMPORARY TABLE IF EXISTS tRoleInherit; + CREATE TEMPORARY TABLE tRoleInherit + (INDEX (inheritsFrom)) + ENGINE = MEMORY + SELECT + CONCAT(vPrefix, r.`name`) prefixedRole, + ri.`name` inheritsFrom + FROM role r + JOIN roleRole rr ON rr.role = r.id + JOIN role ri ON ri.id = rr.inheritsFrom; + + -- Vueve a crear el usuario + + INSERT INTO mysql.user ( + `User`, + `Host`, + `Password`, + `ssl_type`, + `ssl_cipher`, + `x509_issuer`, + `x509_subject`, + `max_questions`, + `max_updates`, + `max_connections`, + `max_user_connections` + ) + SELECT + r.prefixedRole, + vTplHost, + IF('' != u.`Password`, + u.`Password`, t.`Password`), + IF('' != u.`ssl_type`, + u.`ssl_type`, t.`ssl_type`), + IF('' != u.`ssl_cipher`, + u.`ssl_cipher`, t.`ssl_cipher`), + IF('' != u.`x509_issuer`, + u.`x509_issuer`, t.`x509_issuer`), + IF('' != u.`x509_subject`, + u.`x509_subject`, t.`x509_subject`), + IF(0 != u.`max_questions`, + u.`max_questions`, t.`max_questions`), + IF(0 != u.`max_updates`, + u.`max_updates`, t.`max_updates`), + IF(0 != u.`max_connections`, + u.`max_connections`, t.`max_connections`), + IF(0 != u.`max_user_connections`, + u.`max_user_connections`, t.`max_user_connections`) + FROM tRole r + JOIN mysql.user t + ON t.`User` = vTplUser + AND t.`Host` = vTplHost + LEFT JOIN mysql.user u + ON u.`User` = r.role + AND u.`Host` = vHost; + + INSERT INTO mysql.proxies_priv ( + `User`, + `Host`, + `Proxied_user`, + `Proxied_host`, + `Grantor` + ) + SELECT + '', + vHost, + prefixedRole, + vHost, + CONCAT(prefixedRole, '@', vTplHost) + FROM tRole; + + -- Copia los privilegios globales del usuario + + DROP TEMPORARY TABLE IF EXISTS tUserPriv; + CREATE TEMPORARY TABLE tUserPriv + (INDEX (prefixedRole)) + ENGINE = MEMORY + SELECT + r.prefixedRole, + MAX(u.`Select_priv`) `Select_priv`, + MAX(u.`Insert_priv`) `Insert_priv`, + MAX(u.`Update_priv`) `Update_priv`, + MAX(u.`Delete_priv`) `Delete_priv`, + MAX(u.`Create_priv`) `Create_priv`, + MAX(u.`Drop_priv`) `Drop_priv`, + MAX(u.`Reload_priv`) `Reload_priv`, + MAX(u.`Shutdown_priv`) `Shutdown_priv`, + MAX(u.`Process_priv`) `Process_priv`, + MAX(u.`File_priv`) `File_priv`, + MAX(u.`Grant_priv`) `Grant_priv`, + MAX(u.`References_priv`) `References_priv`, + MAX(u.`Index_priv`) `Index_priv`, + MAX(u.`Alter_priv`) `Alter_priv`, + MAX(u.`Show_db_priv`) `Show_db_priv`, + MAX(u.`Super_priv`) `Super_priv`, + MAX(u.`Create_tmp_table_priv`) `Create_tmp_table_priv`, + MAX(u.`Lock_tables_priv`) `Lock_tables_priv`, + MAX(u.`Execute_priv`) `Execute_priv`, + MAX(u.`Repl_slave_priv`) `Repl_slave_priv`, + MAX(u.`Repl_client_priv`) `Repl_client_priv`, + MAX(u.`Create_view_priv`) `Create_view_priv`, + MAX(u.`Show_view_priv`) `Show_view_priv`, + MAX(u.`Create_routine_priv`) `Create_routine_priv`, + MAX(u.`Alter_routine_priv`) `Alter_routine_priv`, + MAX(u.`Create_user_priv`) `Create_user_priv`, + MAX(u.`Event_priv`) `Event_priv`, + MAX(u.`Trigger_priv`) `Trigger_priv`, + MAX(u.`Create_tablespace_priv`) `Create_tablespace_priv` + FROM tRoleInherit r + JOIN mysql.user u + ON u.`User` = r.inheritsFrom + AND u.`Host`= vHost + GROUP BY r.prefixedRole; + + UPDATE mysql.user u + JOIN tUserPriv t + ON u.`User` = t.prefixedRole + AND u.`Host` = vHost + SET + u.`Select_priv` + = t.`Select_priv`, + u.`Insert_priv` + = t.`Insert_priv`, + u.`Update_priv` + = t.`Update_priv`, + u.`Delete_priv` + = t.`Delete_priv`, + u.`Create_priv` + = t.`Create_priv`, + u.`Drop_priv` + = t.`Drop_priv`, + u.`Reload_priv` + = t.`Reload_priv`, + u.`Shutdown_priv` + = t.`Shutdown_priv`, + u.`Process_priv` + = t.`Process_priv`, + u.`File_priv` + = t.`File_priv`, + u.`Grant_priv` + = t.`Grant_priv`, + u.`References_priv` + = t.`References_priv`, + u.`Index_priv` + = t.`Index_priv`, + u.`Alter_priv` + = t.`Alter_priv`, + u.`Show_db_priv` + = t.`Show_db_priv`, + u.`Super_priv` + = t.`Super_priv`, + u.`Create_tmp_table_priv` + = t.`Create_tmp_table_priv`, + u.`Lock_tables_priv` + = t.`Lock_tables_priv`, + u.`Execute_priv` + = t.`Execute_priv`, + u.`Repl_slave_priv` + = t.`Repl_slave_priv`, + u.`Repl_client_priv` + = t.`Repl_client_priv`, + u.`Create_view_priv` + = t.`Create_view_priv`, + u.`Show_view_priv` + = t.`Show_view_priv`, + u.`Create_routine_priv` + = t.`Create_routine_priv`, + u.`Alter_routine_priv` + = t.`Alter_routine_priv`, + u.`Create_user_priv` + = t.`Create_user_priv`, + u.`Event_priv` + = t.`Event_priv`, + u.`Trigger_priv` + = t.`Trigger_priv`, + u.`Create_tablespace_priv` + = t.`Create_tablespace_priv`; + + DROP TEMPORARY TABLE tUserPriv; + + -- Copia los privilegios a nivel de esquema + + INSERT INTO mysql.db ( + `User`, + `Host`, + `Db`, + `Select_priv`, + `Insert_priv`, + `Update_priv`, + `Delete_priv`, + `Create_priv`, + `Drop_priv`, + `Grant_priv`, + `References_priv`, + `Index_priv`, + `Alter_priv`, + `Create_tmp_table_priv`, + `Lock_tables_priv`, + `Create_view_priv`, + `Show_view_priv`, + `Create_routine_priv`, + `Alter_routine_priv`, + `Execute_priv`, + `Event_priv`, + `Trigger_priv` + ) + SELECT + r.prefixedRole, + vTplHost, + t.`Db`, + MAX(t.`Select_priv`), + MAX(t.`Insert_priv`), + MAX(t.`Update_priv`), + MAX(t.`Delete_priv`), + MAX(t.`Create_priv`), + MAX(t.`Drop_priv`), + MAX(t.`Grant_priv`), + MAX(t.`References_priv`), + MAX(t.`Index_priv`), + MAX(t.`Alter_priv`), + MAX(t.`Create_tmp_table_priv`), + MAX(t.`Lock_tables_priv`), + MAX(t.`Create_view_priv`), + MAX(t.`Show_view_priv`), + MAX(t.`Create_routine_priv`), + MAX(t.`Alter_routine_priv`), + MAX(t.`Execute_priv`), + MAX(t.`Event_priv`), + MAX(t.`Trigger_priv`) + FROM tRoleInherit r + JOIN mysql.db t + ON t.`User` = r.inheritsFrom + AND t.`Host`= vHost + GROUP BY r.prefixedRole, t.`Db`; + + -- Copia los privilegios a nivel de tabla + + INSERT INTO mysql.tables_priv ( + `User`, + `Host`, + `Db`, + `Table_name`, + `Grantor`, + `Timestamp`, + `Table_priv`, + `Column_priv` + ) + SELECT + r.prefixedRole, + vTplHost, + t.`Db`, + t.`Table_name`, + t.`Grantor`, + MAX(t.`Timestamp`), + GROUP_CONCAT(CONCAT(t.`Table_priv`, ',')), + GROUP_CONCAT(CONCAT(t.`Column_priv`, ',')) + FROM tRoleInherit r + JOIN mysql.tables_priv t + ON t.`User` = r.inheritsFrom + AND t.`Host`= vHost + GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`; + + -- Copia los privilegios a nivel de columna + + INSERT INTO mysql.columns_priv ( + `User`, + `Host`, + `Db`, + `Table_name`, + `Column_name`, + `Timestamp`, + `Column_priv` + ) + SELECT + r.prefixedRole, + vTplHost, + t.`Db`, + t.`Table_name`, + t.`Column_name`, + MAX(t.`Timestamp`), + GROUP_CONCAT(CONCAT(t.`Column_priv`, ',')) + FROM tRoleInherit r + JOIN mysql.columns_priv t + ON t.`User` = r.inheritsFrom + AND t.`Host`= vHost + GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`, t.`Column_name`; + + -- Copia los privilegios de los procedimientos + + INSERT IGNORE INTO mysql.procs_priv ( + `User`, + `Host`, + `Db`, + `Routine_name`, + `Routine_type`, + `Grantor`, + `Timestamp`, + `Proc_priv` + ) + SELECT + r.prefixedRole, + vTplHost, + t.`Db`, + t.`Routine_name`, + t.`Routine_type`, + t.`Grantor`, + t.`Timestamp`, + t.`Proc_priv` + FROM tRoleInherit r + JOIN mysql.procs_priv t + ON t.`User` = r.inheritsFrom + AND t.`Host`= vHost; + + -- Libera memoria + + DROP TEMPORARY TABLE + tRole, + tRoleInherit; + + FLUSH PRIVILEGES; +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 DROP PROCEDURE IF EXISTS `roleGetDescendents` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `roleGetDescendents`(vRole INT) +BEGIN +/** + * Obtiene los identificadores de todos los subroles + * implementados por un rol (Incluido el mismo). + * + * @param vRole Identificador del rol + * @table tmp.role Subroles implementados por el rol + */ + DECLARE vIsRoot BOOL; + + DROP TEMPORARY TABLE IF EXISTS + tmp.role, parents, childs; + + CREATE TEMPORARY TABLE tmp.role + (UNIQUE (id)) + ENGINE = MEMORY + SELECT vRole AS id; + + CREATE TEMPORARY TABLE parents + ENGINE = MEMORY + SELECT vRole AS id; + + CREATE TEMPORARY TABLE childs + LIKE parents; + + REPEAT + DELETE FROM childs; + INSERT INTO childs + SELECT DISTINCT r.inheritsFrom id + FROM parents p + JOIN roleInherit r ON r.role = p.id + LEFT JOIN tmp.role t ON t.id = r.inheritsFrom + WHERE t.id IS NULL; + + DELETE FROM parents; + INSERT INTO parents + SELECT * FROM childs; + + INSERT INTO tmp.role + SELECT * FROM childs; + + UNTIL ROW_COUNT() <= 0 + END REPEAT; + + -- If it is root all the roles are added + + SELECT COUNT(*) > 0 INTO vIsRoot + FROM tmp.role + WHERE id = 0; + + IF vIsRoot THEN + INSERT IGNORE INTO tmp.role (id) + SELECT id FROM role; + END IF; + + -- Cleaning + + DROP TEMPORARY TABLE + parents, childs; +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 DROP PROCEDURE IF EXISTS `roleSync` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `roleSync`() +BEGIN +/** + * Sincroniza la tabla @roleRole con la jerarquía de roles + * actual. Este procedimiento debe ser llamado cada vez que + * se modifique la tabla @roleInherit para que los cambios + * realizados sobre esta sean efectivos. + */ + DECLARE vRoleId INT; + DECLARE vDone BOOL; + + DECLARE cur CURSOR FOR + SELECT id FROM role; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + TRUNCATE TABLE roleRole; + + OPEN cur; + + l: LOOP + SET vDone = FALSE; + FETCH cur INTO vRoleId; + + IF vDone THEN + LEAVE l; + END IF; + + CALL roleGetDescendents (vRoleId); + + INSERT INTO roleRole (role, inheritsFrom) + SELECT vRoleId, id FROM tmp.role; + + DROP TEMPORARY TABLE tmp.role; + END LOOP; + + CLOSE cur; + + CALL privSync(); +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 DROP PROCEDURE IF EXISTS `userChangePassword` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userChangePassword`(vOldPassword VARCHAR(255), vPassword VARCHAR(255)) +BEGIN +/** + * Changes the current user password, if user is in recovery + * mode ignores the current password. + * + * @param vOldPassword The current password + * @param vPassword The new password + */ + DECLARE vPasswordOk BOOL; + + SELECT `password` = MD5(vOldPassword) OR recoverPass + INTO vPasswordOk + FROM user WHERE id = account.userGetId(); + + IF NOT vPasswordOk THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Invalid password'; + END IF; + + CALL userSetPassword (userGetName(), vPassword); +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 DROP PROCEDURE IF EXISTS `userCheckName` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userCheckName`(vUserName VARCHAR(255)) +BEGIN +/** + * Comprueba que el nombre de usuario reune los requisitos + * de sintaxis necesarios, en caso contrario lanza una + * excepción. + * El nombre de usuario solo debe contener letras minúsculas + * o, a partir del segundo carácter, números o subguiones. + */ + IF vUserName NOT REGEXP '^[a-z0-9_]*$' THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'INVALID_USER_NAME'; + 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 DROP PROCEDURE IF EXISTS `userCheckPassword` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userCheckPassword`(vPassword VARCHAR(255)) +BEGIN +/** + * Comprueba si la contraseña cumple los requisitos de seguridad + * establecidos. Lanza una excepción si no se cumplen. + * + * @param vPassword Contraseña a comprobar + */ + DECLARE vChr CHAR(1); + DECLARE vPasswordOk TINYINT; + DECLARE vI TINYINT DEFAULT 1; + DECLARE vNAlpha TINYINT DEFAULT 0; + DECLARE vNUpper TINYINT DEFAULT 0; + DECLARE vNDigits TINYINT DEFAULT 0; + DECLARE vNPunct TINYINT DEFAULT 0; + + WHILE vI <= CHAR_LENGTH(vPassword) + DO + SET vChr = SUBSTRING(vPassword, vI, 1); + + IF vChr REGEXP '[[:alpha:]]' + THEN + SET vNAlpha = vNAlpha+1; + + IF vChr REGEXP '[A-Z]' + THEN + SET vNUpper = vNUpper+1; + END IF; + ELSEIF vChr REGEXP '[[:digit:]]' + THEN + SET vNDigits = vNDigits+1; + ELSEIF vChr REGEXP '[[:punct:]]' + THEN + SET vNPunct = vNPunct+1; + END IF; + + SET vI = vI+1; + END WHILE; + + SELECT + CHAR_LENGTH(vPassword) >= length + AND vNAlpha >= nAlpha + AND vNUpper >= nUpper + AND vNDigits >= nDigits + AND vNPunct >= nPunct + INTO vPasswordOk + FROM userPassword LIMIT 1; + + IF NOT vPasswordOk THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Password does not meet requirements'; + 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 DROP PROCEDURE IF EXISTS `userLogin` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userLogin`(vUserName VARCHAR(255), vPassword VARCHAR(255)) + READS SQL DATA +BEGIN +/** + * Logs in using the user credentials. + * + * @param vUserName The user name + * @param vPassword The user password + */ + DECLARE vAuthIsOk BOOLEAN DEFAULT FALSE; + + SELECT COUNT(*) = 1 INTO vAuthIsOk FROM user + WHERE name = vUserName + AND password = MD5(vPassword) + AND active; + + IF vAuthIsOk + THEN + CALL userLoginWithName (vUserName); + ELSE + CALL util.throw ('INVALID_CREDENTIALS'); + 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 DROP PROCEDURE IF EXISTS `userLoginWithName` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userLoginWithName`(vUserName VARCHAR(255)) + READS SQL DATA +BEGIN +/** + * Logs in using only the user name. This procedure is + * intended to be executed by users with a high level + * of privileges so that normal users should not have + * execute permissions on it + * + * @param vUserName The user name + */ + DECLARE vUserId INT DEFAULT NULL; + DECLARE vKey VARCHAR(255); + + SELECT id INTO vUserId FROM user + WHERE name = vUserName; + + SELECT loginKey INTO vKey FROM userConfig; + + SET @userId = vUserId; + SET @userName = vUserName; + SET @userSignature = util.hmacSha2(256, CONCAT_WS('/', vUserId, vUserName), vKey); +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 DROP PROCEDURE IF EXISTS `userLogout` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userLogout`() +BEGIN +/** + * Logouts the user. + */ + SET @userId = NULL; + SET @userName = NULL; + SET @userSignature = 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 DROP PROCEDURE IF EXISTS `userSetPassword` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `userSetPassword`(vUserName VARCHAR(255), vPassword VARCHAR(255)) +BEGIN +/** + * Cambia la contraseña del usuario pasado como parámetro. + * Solo los administradores deberian de tener privilegios de + * ejecución sobre el procedimiento ya que no solicita la + * contraseña actual del usuario. + * + * @param vUserName Nombre de usuario + * @param vPassword Nueva contraseña + */ + CALL userCheckPassword (vPassword); + + UPDATE user SET + password = MD5(vPassword), + recoverPass = FALSE + WHERE `name` = vUserName; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Current Database: `util` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `util` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `util`; + +-- +-- Table structure for table `debug` +-- + +DROP TABLE IF EXISTS `debug`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `debug` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `connectionId` int(10) unsigned DEFAULT NULL, + `user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `host` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `variable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de depuración'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'util' +-- + +-- +-- Dumping routines for database 'util' +-- +/*!50003 DROP FUNCTION IF EXISTS `capitalizeFirst` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `capitalizeFirst`(vString VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 + NO SQL + DETERMINISTIC +BEGIN +/** + * Pass the first letter of every word in a string to uppercase. + * + * @param vString String to tranform + * @return Transformed string + */ + DECLARE vNewString VARCHAR(255) DEFAULT ''; + DECLARE vI INT DEFAULT 1; + DECLARE vSpaceIni, vWordIni INT; + DECLARE vLen INT DEFAULT CHAR_LENGTH(vString); + + WHILE vI < vLen + DO + SET vSpaceIni = vI; + + WHILE MID(vString, vI, 1) REGEXP '[[:space:]]' DO + SET vI = vI + 1; + END WHILE; + + SET vWordIni = vI; + SET vI = vWordIni + 1; + + WHILE vI <= vLen AND MID(vString, vI, 1) NOT REGEXP '[[:space:]]' DO + SET vI = vI + 1; + END WHILE; + + SET vNewString = CONCAT(vNewString + ,MID(vString, vSpaceIni, vWordIni - vSpaceIni) + ,UPPER(MID(vString, vWordIni, 1)) + ,MID(vString, vWordIni + 1, vI - vWordIni - 1) + ); + END WHILE; + + RETURN vNewString; +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 DROP FUNCTION IF EXISTS `dayEnd` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `dayEnd`(vDated DATE) RETURNS datetime + NO SQL + DETERMINISTIC +BEGIN +/** + * Formats a date to the end of the day. + * + * @param vDated The date to format + * @return The formatted date + */ + RETURN TIMESTAMP(vDated, '23:59:59'); +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 DROP FUNCTION IF EXISTS `firstDayOfMonth` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `firstDayOfMonth`(vDate DATE) RETURNS date + NO SQL + DETERMINISTIC +BEGIN +/** + * Returns the date formatted to the first day of month. + * + * @param vDate The date to format + * @return The formatted date + */ + RETURN DATE_FORMAT(vDate, '%Y-%m-01'); +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 DROP FUNCTION IF EXISTS `hmacSha2` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `hmacSha2`(`vAlg` SMALLINT, `vMsg` MEDIUMBLOB, `vKey` MEDIUMBLOB) RETURNS varchar(128) CHARSET utf8 + NO SQL + DETERMINISTIC +BEGIN +/** + * HMAC function based on SHA2 vAlgorythms. + */ + DECLARE vHashlen INT UNSIGNED; + DECLARE vOpad, vIpad TINYBLOB; + + CASE vAlg + WHEN 224 THEN SET vHashlen = 64; + WHEN 256 THEN SET vHashlen = 64; + WHEN 384 THEN SET vHashlen = 128; + WHEN 512 THEN SET vHashlen = 128; + ELSE CALL throw ('WRONG_vALGORYTHM_IDENTIFICATOR_USED'); + END CASE; + + IF LENGTH(vKey) > vHashlen THEN + SET vKey = UNHEX(SHA2(vKey, vAlg)); + END IF; + + SET vKey = RPAD(vKey, vHashlen, 0x00); + + SET vIpad = stringXor(vKey, 0x36); + SET vOpad = stringXor(vKey, 0x5C); + + RETURN SHA2(CONCAT(vOpad, UNHEX(SHA2(CONCAT(vIpad, vMsg), vAlg))), vAlg); +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 DROP FUNCTION IF EXISTS `lang` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `lang`() RETURNS char(2) CHARSET utf8 + NO SQL + DETERMINISTIC +BEGIN +/** + * Returns the current language code. + * + * @return The language code + */ + RETURN IFNULL(@lang, SUBSTR(@@lc_messages, 1, 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 DROP FUNCTION IF EXISTS `nextWeek` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `nextWeek`(vYearWeek INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * A partir de un perido año/semana en formato AAAASS devuelve el siguiente + * periodo. Esta función trabaja de la misma forma que la función WEEK() en + * modo 3. + */ + DECLARE vYear INT DEFAULT FLOOR(vYearWeek / 100); + + IF vYearWeek < YEARWEEK(CONCAT(vYear, '-12-31'), 3) THEN + RETURN vYearWeek + 1; + ELSE + RETURN ((vYear + 1) * 100) + 1; + 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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP FUNCTION IF EXISTS `stringXor` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `stringXor`(vString MEDIUMBLOB, vConst TINYINT UNSIGNED) RETURNS mediumblob + NO SQL + DETERMINISTIC +BEGIN +/** + * Returns XOR of binary string and an 8-bit constant. + */ + DECLARE vLen, vPos INT UNSIGNED; + DECLARE vResult MEDIUMBLOB; + + SET vLen = LENGTH(vString); + SET vPos = 1; + SET vResult = ''; + + WHILE vPos <= vLen DO + SET vResult = CONCAT(vResult, LPAD(HEX( ORD(SUBSTR(vString, vPos, 1)) ^ vConst), 2, '0')); + SET vPos = vPos + 1; + END WHILE; + + RETURN UNHEX(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 DROP FUNCTION IF EXISTS `today` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `today`() RETURNS date + DETERMINISTIC +BEGIN +/** + * Devuelve la fecha actual. Usar en lugar de la función nativa + * CURDATE() en aquellos que se necesite rendimiento ya que la + * la última no es determinista. + * + * @return La fecha actual + */ + RETURN 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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP FUNCTION IF EXISTS `twoDaysAgo` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `twoDaysAgo`() RETURNS date + DETERMINISTIC +BEGIN +/** + * Devuelve la fecha de antes de ayer. + * + * @return La fecha de antes de ayer + */ + RETURN TIMESTAMPADD(DAY, -2, 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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP FUNCTION IF EXISTS `yearRelativePosition` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `yearRelativePosition`(vYear INT) RETURNS varchar(20) CHARSET utf8 + DETERMINISTIC +BEGIN +/** + * Devuelve la posicion del año relativa al año actual. + * Se utiliza como cabecera en informes de balances. + * + * @param vYear Año a evaluar + * @return La posicion relativa del año + */ + DECLARE vCurYear INT DEFAULT YEAR(CURDATE()); + + IF vYear = vCurYear THEN + RETURN 'curYear'; + END IF; + + IF vYear = vCurYear - 1 THEN + RETURN 'lastYear'; + END IF; + + IF vYear = vCurYear - 2 THEN + RETURN 'twoYearsAgo'; + END IF; + + RETURN 'other'; +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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP FUNCTION IF EXISTS `yesterday` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `yesterday`() RETURNS date + DETERMINISTIC +BEGIN +/** + * Devuelve la fecha de ayer. + * + * @return La fecha de ayer + */ + RETURN TIMESTAMPADD(DAY, -1, 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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `debugAdd` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `debugAdd`(vVariable VARCHAR(255), vValue VARCHAR(255)) + MODIFIES SQL DATA +BEGIN +/** + * Añade una entrada de depuración en la tabla @debug. + * + * @param vVariable Nombre de variable + * @param vValue Valor de la variable + */ + DECLARE vIndex INT DEFAULT INSTR(USER(), '@'); + + INSERT INTO debug SET + `connectionId` = CONNECTION_ID(), + `user` = LEFT(USER(), vIndex - 1), + `host` = RIGHT(USER(), CHAR_LENGTH(USER()) - vIndex), + `variable` = vVariable, + `value` = vValue; +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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `exec` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `exec`(vSqlQuery TEXT) +BEGIN +/** + * Executes a string with an SQL query. + * + * @param vSqlQuery The SQL string + */ + SET @sqlQuery = vSqlQuery; + + PREPARE stmt FROM @sqlQuery; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + + SET @sqlQuery = 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 DROP PROCEDURE IF EXISTS `findObject` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `findObject`(vChain VARCHAR(45)) + READS SQL DATA +BEGIN +/** + * Devuelve un listado de todos los procedimientos, funciones + * eventos, disparadores y vistas que inluyen una cadena dada. + * + * @param vChain Cadena a buscar + * @select Listado de objetos + */ + SET vChain = CONCAT('%', vChain, '%'); + + SELECT * FROM + ( + SELECT + `db`, + `name`, + `type`, + `body`, + `created`, + `modified` + FROM `mysql`.`proc` + WHERE `body` LIKE vChain COLLATE utf8_general_ci + UNION ALL + SELECT + `db`, + `name`, + 'EVENT', + `body_utf8`, + `created`, + `modified` + FROM `mysql`.`event` + WHERE `body_utf8` LIKE vChain COLLATE utf8_general_ci + UNION ALL + SELECT + `EVENT_OBJECT_SCHEMA`, + `TRIGGER_NAME`, + 'TRIGGER', + `ACTION_STATEMENT`, + NULL, + NULL + FROM `information_schema`.`TRIGGERS` + WHERE `ACTION_STATEMENT` LIKE vChain COLLATE utf8_general_ci + UNION ALL + SELECT + `TABLE_SCHEMA`, + `TABLE_NAME`, + 'VIEW', + `VIEW_DEFINITION`, + NULL, + NULL + FROM `information_schema`.`VIEWS` + WHERE `VIEW_DEFINITION` LIKE vChain COLLATE utf8_general_ci + ) t + ORDER BY `db`, `name`; +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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `throw` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `throw`(vMessage CHAR(35)) +BEGIN +/** + * Throws a user-defined exception. + * + * @param vMessage The error message + */ + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = vMessage; +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 DROP PROCEDURE IF EXISTS `warn` */; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-developer`@`%` PROCEDURE `warn`(vCode CHAR(35)) +BEGIN + DECLARE w VARCHAR(1) DEFAULT '__'; + SET @warn = vCode; +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 */ ; +ALTER DATABASE `util` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- -- Current Database: `vn2008` @@ -1643,10 +2229,11 @@ CREATE TABLE `Agencias` ( `show_AgencyName` tinyint(1) DEFAULT '1', `tpv` tinyint(1) NOT NULL DEFAULT '1', `externalAgency` tinyint(1) NOT NULL DEFAULT '0', + `flag` blob, PRIMARY KEY (`Id_Agencia`), KEY `Agencias` (`Agencia`), KEY `Vista` (`Vista`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1108 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1665,7 +2252,7 @@ CREATE TABLE `Agencias_dits` ( `value_old` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `value_new` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idAgencia_dits`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14748 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1747,7 +2334,7 @@ CREATE TABLE `Articles` ( `generic` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', `producer_id` mediumint(3) unsigned DEFAULT NULL, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `density` double NOT NULL DEFAULT '167' COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes ', + `density` double NOT NULL DEFAULT '167' COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes, si no se especifica se pone por defecto la del tipo en un trigger', `relevancy` tinyint(1) NOT NULL DEFAULT '0', `expenceFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '7001000000', PRIMARY KEY (`Id_Article`), @@ -1764,8 +2351,8 @@ CREATE TABLE `Articles` ( CONSTRAINT `Articles_ibfk_4` FOREIGN KEY (`iva_group_id`) REFERENCES `iva_group` (`iva_group_id`) ON UPDATE CASCADE, CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE, - CONSTRAINT `producer_id` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `producer_id` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=300035 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -1949,7 +2536,7 @@ CREATE TABLE `Articles_dits` ( KEY `fgkey1_idx` (`idaccion_dits`), KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19689 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -1968,132 +2555,8 @@ CREATE TABLE `Articles_nicho` ( KEY `Articles_nicho_wh_fk` (`warehouse_id`), CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=296877 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Articles_nichoBeforeInsert` - BEFORE INSERT ON `Articles_nicho` FOR EACH ROW -BEGIN - -- XXX: Intenta localizar al usuario que introduce BIO en esta tabla. - - IF NEW.nicho IS NOT NULL AND NEW.nicho LIKE '%BIO%' - THEN - CALL util.debugAdd ('nicho', NEW.nicho); - 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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Articles_nicho_AFTER_INSERT` AFTER INSERT ON `Articles_nicho` FOR EACH ROW -BEGIN - -DECLARE mailText VARCHAR(90); - -IF NEW.nicho LIKE 'BIONIC%' THEN - - SELECT IFNULL(CONCAT(Id_Trabajador, ' ', CodigoTrabajador, ' ' ,Nombre, ' ' , Apellidos),'TRABAJADOR NO ENCONTRADO') - INTO mailText - FROM Trabajadores - WHERE Id_Trabajador = vn2008.get_Trabajador(); - - SELECT CONCAT(mailText, ' ', Article, ' ', Medida) - INTO mailText - FROM Articles - WHERE Id_Article = NEW.Id_Article; - - INSERT INTO mail(`to`,reply_to,subject,text) - VALUES('pako@verdnatura.es,nelo@verdnatura.es','informatica@verdnatura.es','BIONIC INSERT',mailText); - - -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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Articles_nichoBeforeUpdate` - BEFORE UPDATE ON `Articles_nicho` FOR EACH ROW -BEGIN - -- XXX: Intenta localizar al usuario que introduce BIO en esta tabla. - - IF NOT (NEW.nicho <=> OLD.nicho) AND NEW.nicho LIKE '%BIO%' - THEN - CALL util.debugAdd ('nicho', NEW.nicho); - 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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Articles_nicho_AFTER_UPDATE` AFTER UPDATE ON `Articles_nicho` FOR EACH ROW -BEGIN - -DECLARE mailText VARCHAR(90); - -IF NEW.nicho LIKE 'BIONIC%' THEN - - SELECT IFNULL(CONCAT(Id_Trabajador, ' ', CodigoTrabajador, ' ' ,Nombre, ' ' , Apellidos),'TRABAJADOR NO ENCONTRADO') - INTO mailText - FROM Trabajadores - WHERE Id_Trabajador = vn2008.get_Trabajador(); - - SELECT CONCAT(mailText, ' ', Article, ' ', Medida) - INTO mailText - FROM Articles - WHERE Id_Article = NEW.Id_Article; - - INSERT INTO mail(`to`,reply_to,subject,text) - VALUES('pako@verdnatura.es,nelo@verdnatura.es','informatica@verdnatura.es','BIONIC UPDATE',mailText); - - -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 */ ; -- -- Table structure for table `Articles_old` @@ -2194,7 +2657,7 @@ CREATE TABLE `Bancos_poliza` ( KEY `Id_Poliza_Empresa_idx` (`empresa_id`), CONSTRAINT `Id_Banco_Poliza` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `Id_Poliza_Empresa` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lineas de credito asociadas a cuentas corrientes'; +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lineas de credito asociadas a cuentas corrientes'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2251,7 +2714,7 @@ CREATE TABLE `Cajas` ( KEY `warehouse_id` (`warehouse_id`), KEY `fk_Cajas_Proveedores_account1_idx` (`Proveedores_account_Id`), CONSTRAINT `Cajas_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=551258 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2348,7 +2811,7 @@ CREATE TABLE `Clientes` ( `retener` tinyint(1) NOT NULL DEFAULT '0', `congelado` tinyint(1) NOT NULL DEFAULT '0', `Id_Trabajador` int(11) DEFAULT NULL, - `credito` double NOT NULL DEFAULT '0', + `credito` decimal(10,2) NOT NULL DEFAULT '0.00', `cyc` double DEFAULT NULL, `Id_Pais` mediumint(8) unsigned NOT NULL DEFAULT '1', `activo` tinyint(1) NOT NULL DEFAULT '1', @@ -2374,7 +2837,10 @@ CREATE TABLE `Clientes` ( `creditInsurance` int(11) DEFAULT NULL, `EYPBC` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Email\nYesterday\nPurchases\nBy\nConsigna', `invoiceByAddress` tinyint(1) DEFAULT '0', - `cplusTerIdNifFk` int(11) NOT NULL DEFAULT '1', + `cplusTerIdNifFk` int(11) NOT NULL DEFAULT '1' COMMENT 'OBSOLETO', + `isCreatedAsServed` tinyint(1) DEFAULT '0', + `hasInvoiceSimplified` tinyint(1) NOT NULL DEFAULT '0', + `iban` varchar(45) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id_cliente`), UNIQUE KEY `IF` (`if`), KEY `Id_Trabajador` (`Id_Trabajador`), @@ -2387,19 +2853,15 @@ CREATE TABLE `Clientes` ( KEY `Telefono` (`telefono`), KEY `movil` (`movil`), KEY `tipos_de_cliente_idx` (`clientes_tipo_id`), - KEY `cpostcode_fk_idx` (`postcode_id`), KEY `codpos` (`codpos`,`codPostal`), - KEY `clientes_fk_6_idx` (`cplusTerIdNifFk`), CONSTRAINT `Clientes_ibfk_1` FOREIGN KEY (`Id_Pais`) REFERENCES `Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_2` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_4` FOREIGN KEY (`default_address`) REFERENCES `Consignatarios` (`id_consigna`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_5` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, - CONSTRAINT `Clientes_postcode` FOREIGN KEY (`postcode_id`) REFERENCES `postcodeKK` (`postcode_id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`chanel_id`) REFERENCES `chanel` (`chanel_id`) ON UPDATE CASCADE, - CONSTRAINT `clientes_fk_6` FOREIGN KEY (`cplusTerIdNifFk`) REFERENCES `vn`.`cplusTerIdNif` (`id`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientes_tipo_id`) REFERENCES `clientes_tipo` (`clientes_tipo_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10126 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2414,6 +2876,16 @@ DELIMITER ;; BEFORE INSERT ON `Clientes` FOR EACH ROW BEGIN + DECLARE isAlreadyUsedIf BOOL; + + SELECT COUNT(*) INTO isAlreadyUsedIf + FROM Clientes + WHERE `IF` = TRIM(NEW.`IF`); + + IF isAlreadyUsedIf THEN + CALL util.throw ('Error. El NIF/CIF está repetido'); + END IF; + CALL pbx.phoneIsValid (NEW.telefono); CALL pbx.phoneIsValid (NEW.movil); CALL pbx.phoneIsValid (NEW.fax); @@ -2471,8 +2943,16 @@ DELIMITER ;; BEFORE UPDATE ON `Clientes` FOR EACH ROW BEGIN - DECLARE vEmployee INT; DECLARE vText VARCHAR(255) DEFAULT NULL; + DECLARE isAlreadyUsedIf BOOLEAN; + + SELECT (COUNT(*) > 1) INTO isAlreadyUsedIf + FROM Clientes + WHERE `IF` = TRIM(NEW.`IF`); + + IF isAlreadyUsedIf THEN + CALL util.throw ('Error. El NIF/CIF está repetido'); + END IF; -- Comprueba que el formato de los teléfonos es válido @@ -2488,21 +2968,14 @@ BEGIN CALL pbx.phoneIsValid (NEW.fax); END IF; - -- Actualiza el crédito - - SELECT Id_Trabajador INTO vEmployee - FROM Trabajadores WHERE user_id = account.userGetId(); - - IF vEmployee IS NULL THEN - SET vEmployee = 20; - END IF; + -- Actualiza el log del crédito IF !(NEW.Credito <=> OLD.Credito) AND IFNULL(NEW.Credito, 0) >= 0 - THEN + THEN INSERT INTO credit SET - Id_Cliente = NEW.Id_Cliente, - amount = NEW.Credito, - Id_Trabajador = vEmployee; + Id_Cliente = NEW.Id_Cliente, + amount = NEW.Credito, + Id_Trabajador = vn.getWorker(); END IF; -- Avisar al comercial si ha llegado la documentación sepa/core @@ -2558,7 +3031,7 @@ CREATE TABLE `Clientes_cedidos` ( CONSTRAINT `cliente_cedido_fk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `new_trabajador_fk` FOREIGN KEY (`Id_Trabajador_new`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `trabajador_fk` FOREIGN KEY (`Id_Trabajador_old`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que se han cambiado de comercial, pero durante un tiempo comisionan a los dos, al anterior y al actual'; +) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que se han cambiado de comercial, pero durante un tiempo comisionan a los dos, al anterior y al actual'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2579,7 +3052,7 @@ CREATE TABLE `Clientes_dits` ( 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=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=71640 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2598,7 +3071,7 @@ CREATE TABLE `Clientes_empresa` ( PRIMARY KEY (`Id_Clientes_empresa`), KEY `empresa_id_idx` (`empresa_id`), CONSTRAINT `empresa_id` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Empresa por defecto para crear los tickets'; +) ENGINE=InnoDB AUTO_INCREMENT=470497 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Empresa por defecto para crear los tickets'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2675,11 +3148,11 @@ CREATE TABLE `Colas` ( KEY `Id_Prioridad` (`Id_Prioridad`), KEY `Id_Trabajador` (`Id_Trabajador`), CONSTRAINT `Colas_ibfk_1` FOREIGN KEY (`Id_Informe`) REFERENCES `Informes` (`Id_Informe`) ON UPDATE CASCADE, - CONSTRAINT `Colas_ibfk_2` FOREIGN KEY (`Id_Estado`) REFERENCES `Estados` (`Id_Estado`) ON UPDATE CASCADE, + CONSTRAINT `Colas_ibfk_2` FOREIGN KEY (`Id_Estado`) REFERENCES `Estadoskk` (`Id_Estado`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_3` FOREIGN KEY (`Id_Prioridad`) REFERENCES `Prioridades` (`Id_Prioridad`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_4` FOREIGN KEY (`Id_Impresora`) REFERENCES `Impresoras` (`Id_Impresora`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_5` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19777 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2761,7 +3234,7 @@ CREATE TABLE `Compres` ( CONSTRAINT `Compres_ibfk_2` FOREIGN KEY (`Id_Cubo`) REFERENCES `Cubos` (`Id_Cubo`) ON UPDATE CASCADE, CONSTRAINT `Compres_ibfk_3` FOREIGN KEY (`container_id`) REFERENCES `container` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=236271662 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2938,13 +3411,13 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Table structure for table `Compres_2014` +-- Table structure for table `Compres_2014_kk` -- -DROP TABLE IF EXISTS `Compres_2014`; +DROP TABLE IF EXISTS `Compres_2014_kk`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Compres_2014` ( +CREATE TABLE `Compres_2014_kk` ( `Id_Compra` int(11) NOT NULL AUTO_INCREMENT, `Id_Entrada` int(11) NOT NULL DEFAULT '0', `Id_Article` int(11) NOT NULL DEFAULT '90', @@ -3013,7 +3486,7 @@ CREATE TABLE `Compres_ok` ( KEY `Id_Movimiento` (`Id_Compra`), KEY `Id_Accion` (`Id_Accion`), CONSTRAINT `Compres_ok_ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15683 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3052,14 +3525,12 @@ CREATE TABLE `Consignatarios` ( KEY `province_id` (`province_id`), KEY `telefono` (`telefono`), KEY `movil` (`movil`), - KEY `Consignatarios_postcode_idx` (`postcode_id`), KEY `CODPOSTAL` (`codPostal`), CONSTRAINT `Consignatarios_ibfk_1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Consignatarios_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, CONSTRAINT `Consignatarios_ibfk_4` FOREIGN KEY (`Id_Agencia`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, - CONSTRAINT `Consignatarios_postcode` FOREIGN KEY (`postcode_id`) REFERENCES `postcodeKK` (`postcode_id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `address_customer_id` FOREIGN KEY (`Id_cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=24016 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3243,7 +3714,7 @@ CREATE TABLE `Contactos` ( PRIMARY KEY (`Id_Contacto`), KEY `Telefono` (`Telefono`), KEY `Movil` (`Movil`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2590 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3338,21 +3809,22 @@ DROP TABLE IF EXISTS `Cubos`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Cubos` ( `Id_Cubo` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `Volumen` double DEFAULT '0', - `X` double DEFAULT '0', - `Y` double DEFAULT '0', - `Z` double DEFAULT '0', - `Valor` double DEFAULT '0', + `Volumen` decimal(10,2) DEFAULT '0.00', + `X` decimal(10,2) DEFAULT '0.00', + `Y` decimal(10,2) DEFAULT '0.00', + `Z` decimal(10,2) DEFAULT '0.00', + `Valor` decimal(10,2) DEFAULT '0.00', `Retornable` tinyint(1) NOT NULL DEFAULT '0', `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `idCubos_Retorno` int(11) DEFAULT NULL, `Bajan` int(11) DEFAULT NULL, `Suben` int(11) DEFAULT NULL, - `Base` double DEFAULT NULL, + `Base` decimal(10,2) DEFAULT NULL, `item_id` int(11) DEFAULT NULL, - `pvp` double NOT NULL, + `pvp` decimal(10,2) NOT NULL, `box` tinyint(1) NOT NULL DEFAULT '0', - `bultoCubico` double DEFAULT NULL, + `bultoCubico` decimal(10,2) DEFAULT NULL, + `costeRetorno` decimal(10,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`Id_Cubo`), KEY `Article` (`item_id`), CONSTRAINT `Article` FOREIGN KEY (`item_id`) REFERENCES `Articles` (`Id_Article`) ON UPDATE CASCADE @@ -3372,7 +3844,7 @@ CREATE TABLE `Cubos_Retorno` ( `Vacio` double NOT NULL DEFAULT '0', `Lleno` double NOT NULL DEFAULT '0', PRIMARY KEY (`idCubos_Retorno`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3397,7 +3869,7 @@ CREATE TABLE `Enlaces Facturas` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `Enlaces@0020Facturas_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23889 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3438,7 +3910,7 @@ CREATE TABLE `Entradas` ( CONSTRAINT `Entradas_ibfk_1` FOREIGN KEY (`Id_Proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_6` FOREIGN KEY (`travel_id`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_7` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDB AUTO_INCREMENT=133866 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3503,6 +3975,11 @@ BEGIN SET NEW.Id_Moneda = 2; END IF; END IF; + + IF NEW.Id_Moneda = 2 THEN + SET NEW.comision = getComision(NEW.Id_Entrada, NEW.Id_Moneda); + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3522,6 +3999,9 @@ DELIMITER ;; AFTER UPDATE ON `Entradas` FOR EACH ROW BEGIN CALL stock.queueAdd ('entry', NEW.Id_Entrada, OLD.Id_Entrada); + + + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -3558,7 +4038,7 @@ DROP TABLE IF EXISTS `Entradas_Auto`; CREATE TABLE `Entradas_Auto` ( `Id_Entrada` int(11) NOT NULL, PRIMARY KEY (`Id_Entrada`), - CONSTRAINT `Entradas_Auto_ibfk_1` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON UPDATE CASCADE + CONSTRAINT `Entradas_Auto_ibfk_1` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3584,7 +4064,7 @@ CREATE TABLE `Entradas_dits` ( CONSTRAINT `Entradas_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Entradas` (`Id_Entrada`) 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 `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2530450 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3602,7 +4082,7 @@ 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 `Entradas` (`Id_Entrada`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3690,7 +4170,7 @@ CREATE TABLE `Equipos` ( PRIMARY KEY (`id`), KEY `trabajador_id` (`trabajador_id`), CONSTRAINT `Equipos_ibfk_1` FOREIGN KEY (`trabajador_id`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=134 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3709,21 +4189,21 @@ CREATE TABLE `Espionajes` ( `Id_Equipo` int(11) DEFAULT NULL, PRIMARY KEY (`idEspionaje`), KEY `index` (`Id_Trabajador`,`Fecha`) -) ENGINE=MyISAM AUTO_INCREMENT=75646 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=75648 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Estados` +-- Table structure for table `Estadoskk` -- -DROP TABLE IF EXISTS `Estados`; +DROP TABLE IF EXISTS `Estadoskk`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estados` ( +CREATE TABLE `Estadoskk` ( `Id_Estado` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `Estado` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`Id_Estado`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3771,7 +4251,7 @@ CREATE TABLE `Estanterias_distri_name` ( `idEstanterias_distri` int(11) NOT NULL AUTO_INCREMENT, `Descripcion` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`idEstanterias_distri`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3845,7 +4325,7 @@ CREATE TABLE `Facturas` ( CONSTRAINT `Facturas_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `vn`.`cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_bank_id` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=439842 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3884,7 +4364,7 @@ BEGIN WHERE Serie LIKE NEW.Serie AND ((Year(NEW.Fecha) = Year(Fecha) AND length(Id_Factura) > 6 - AND empresa_id = NEW.empresa_id) /*OR (NEW.Serie LIKE 'B' AND length(Id_Factura) > 7)*/ ); + AND empresa_id = NEW.empresa_id) /*OR (NEW.Serie LIKE 'B' AND length(Id_Factura) > 7)*/); ELSE @@ -4020,7 +4500,7 @@ CREATE TABLE `Forms` ( `id` int(11) NOT NULL AUTO_INCREMENT, `titulo` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4063,7 +4543,7 @@ CREATE TABLE `Greuges` ( KEY `Id_Ticket_Greuge_Ticket_idx` (`Id_Ticket`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`Greuges_type_id`) REFERENCES `Greuges_type` (`Greuges_type_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; +) ENGINE=InnoDB AUTO_INCREMENT=1740537 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4103,7 +4583,7 @@ CREATE TABLE `Greuges_type` ( `Greuges_type_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`Greuges_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4120,7 +4600,7 @@ CREATE TABLE `Grupos` ( `observation_type_id` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4204,7 +4684,8 @@ CREATE TABLE `Monedas` ( `Moneda` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `Descripcion` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `Cambio` double NOT NULL DEFAULT '1', - PRIMARY KEY (`Id_Moneda`) + PRIMARY KEY (`Id_Moneda`), + UNIQUE KEY `Moneda_UNIQUE` (`Moneda`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -4261,7 +4742,7 @@ CREATE TABLE `Movimientos` ( KEY `itemFk_ticketFk` (`Id_Article`,`Id_Ticket`), CONSTRAINT `Movimientos_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `movement_ticket_id` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19632525 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4387,7 +4868,6 @@ CREATE TABLE `Movimientos_componentes` ( `Valor` double NOT NULL, `greuge` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`Id_Movimiento`,`Id_Componente`), - KEY `fk_comp_mov_idx` (`Id_Movimiento`), KEY `fk_mov_comp_idx` (`Id_Componente`), CONSTRAINT `mc_fk1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `mc_fk2` FOREIGN KEY (`Id_Componente`) REFERENCES `bi`.`tarifa_componentes` (`Id_Componente`) ON DELETE CASCADE ON UPDATE CASCADE @@ -4411,7 +4891,7 @@ CREATE TABLE `Movimientos_mark` ( `Id_Movimiento_mark` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id_Movimiento_mark`), KEY `Id_Movimiento` (`Id_Movimiento`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9115997 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4481,7 +4961,7 @@ CREATE TABLE `Ordenes` ( KEY `Id_Comprador` (`CodCOMPRADOR`), KEY `Id_Movimiento` (`Id_Movimiento`), KEY `Id_Vendedor` (`CodVENDEDOR`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26052 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4504,7 +4984,7 @@ CREATE TABLE `Origen` ( KEY `warehouse_id` (`warehouse_id`), KEY `Id_Paises` (`Id_Paises`), CONSTRAINT `Origen_ibfk_1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4527,7 +5007,7 @@ CREATE TABLE `Pagares` ( KEY `empresa_id` (`kk_empresa_id`), KEY `pago_id` (`pago_id`), CONSTRAINT `Pagares_ibfk_2` FOREIGN KEY (`pago_id`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2834 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4549,7 +5029,7 @@ CREATE TABLE `Paises` ( `geoFk` int(11) DEFAULT NULL, PRIMARY KEY (`Id`), KEY `Id_Paisreal` (`Id_Paisreal`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4590,7 +5070,7 @@ CREATE TABLE `PreciosEspeciales` ( CONSTRAINT `sp_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `{01A99AF1-3D3F-4B15-AC0C-C7A834F319A3}` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `{EE4ADEF6-0AC6-401F-B7C4-D797972FC065}` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=690 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4648,14 +5128,12 @@ CREATE TABLE `Proveedores` ( KEY `pay_met_id` (`pay_met_id`), KEY `province_id` (`province_id`), KEY `pay_dem_id` (`pay_dem_id`), - KEY `postcode_fk_idx` (`postcode_id`), KEY `codpos` (`codpos`,`CP`), CONSTRAINT `Id_Pais` FOREIGN KEY (`pais_id`) REFERENCES `Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `pay_dem_id` FOREIGN KEY (`pay_dem_id`) REFERENCES `pay_dem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, - CONSTRAINT `postcode_fk` FOREIGN KEY (`postcode_id`) REFERENCES `postcodeKK` (`postcode_id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `province_id` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2421 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4674,14 +5152,28 @@ CREATE TABLE `Proveedores_account` ( `number` varchar(10) CHARACTER SET utf8 DEFAULT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `bic_sufix` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', - `entity_id` int(10) NOT NULL, + `entity_id` int(10) DEFAULT NULL, `Id_Banco` int(11) DEFAULT NULL, PRIMARY KEY (`Id_Proveedores_account`), KEY `fk_proveedores_proveedores_account_idx` (`Id_Proveedor`), KEY `fk_Proveedores_account_entity1_idx` (`entity_id`), KEY `fk_banco_prov_account_idx` (`Id_Banco`), CONSTRAINT `fk_banco_prov_account` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=590 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Proveedores_cargueras` +-- + +DROP TABLE IF EXISTS `Proveedores_cargueras`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Proveedores_cargueras` ( + `Id_Proveedor` int(11) NOT NULL, + PRIMARY KEY (`Id_Proveedor`), + CONSTRAINT `proveedores_cargueras_fk1` FOREIGN KEY (`Id_Proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla de espcializacion para señalar las compañias que prestan servicio de transitario'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4714,7 +5206,7 @@ CREATE TABLE `Proveedores_escritos` ( `escrito` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `informe` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4752,13 +5244,13 @@ CREATE TABLE `Recibos` ( `conciliado` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', PRIMARY KEY (`Id`), KEY `Id_Banco` (`Id_Banco`), - KEY `Id_Cliente` (`Id_Cliente`), KEY `Id_Trabajador` (`Id_Trabajador`), KEY `empresa_id` (`empresa_id`), + KEY `clientDate` (`Id_Cliente`,`Fechacobro`), CONSTRAINT `Recibos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Recibos_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=435028 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4849,7 +5341,7 @@ CREATE TABLE `Relaciones` ( KEY `Id_Contacto` (`Id_Contacto`), KEY `Id_Proveedor` (`Id_Proveedor`), KEY `Id_Cliente` (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2592 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4869,7 +5361,7 @@ CREATE TABLE `Remesas` ( KEY `empresa_id` (`empresa_id`), CONSTRAINT `Remesas_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Remesas_ibfk_2` FOREIGN KEY (`Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=999 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4919,12 +5411,13 @@ CREATE TABLE `Rutas` ( `gestdoc_id` int(11) DEFAULT NULL, `cost` double unsigned DEFAULT NULL, `m3` decimal(10,1) unsigned DEFAULT NULL, + `description` text COLLATE utf8_unicode_ci, PRIMARY KEY (`Id_Ruta`), KEY `Id_Agencia` (`Id_Agencia`), KEY `Fecha` (`Fecha`), KEY `gestdoc_id` (`gestdoc_id`), CONSTRAINT `Rutas_ibfk_1` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=35105 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4986,7 +5479,7 @@ CREATE TABLE `Rutas_Master` ( PRIMARY KEY (`id`), KEY `fk_rutas_warehouse_id_idx` (`warehouse_id`), CONSTRAINT `fk_rutas_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5011,7 +5504,32 @@ CREATE TABLE `Rutas_dits` ( CONSTRAINT `fk_Id_Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fk_Id_ruta` FOREIGN KEY (`Id_Ticket`) REFERENCES `Rutas` (`Id_Ruta`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_action_dits` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=300164 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Rutas_monitor` +-- + +DROP TABLE IF EXISTS `Rutas_monitor`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Rutas_monitor` ( + `Id_Ruta` int(10) unsigned NOT NULL, + `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `Ubicacion` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `pedidosEncajados` int(11) DEFAULT NULL, + `pedidosLibres` int(11) DEFAULT NULL, + `bultos` int(11) DEFAULT NULL, + `notas` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `pedidosProduccion` int(11) DEFAULT NULL, + `fecha` date DEFAULT NULL, + `dockFk` int(11) DEFAULT NULL, + PRIMARY KEY (`Id_Ruta`), + KEY `Rutas_monitor_fk_2_idx` (`dockFk`), + CONSTRAINT `Rutas_monitor_fk_1` FOREIGN KEY (`Id_Ruta`) REFERENCES `Rutas` (`Id_Ruta`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Rutas_monitor_fk_2` FOREIGN KEY (`dockFk`) REFERENCES `dock` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite ubicar y controlar el estado de preparacion de las rutas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5052,7 +5570,7 @@ CREATE TABLE `Saldos_Prevision` ( KEY `empresa_prevision_idx` (`empresa_id`), CONSTRAINT `banco_prevision` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `empresa_prevision` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; +) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5087,7 +5605,7 @@ CREATE TABLE `Split_lines` ( KEY `Id_Compra` (`Id_Compra`), CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) 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=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=312071 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5105,7 +5623,7 @@ CREATE TABLE `Splits` ( `Notas` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`Id_Split`), KEY `Id_Entrada` (`Id_Entrada`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36105 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5133,7 +5651,7 @@ CREATE TABLE `Stockcontrol` ( CONSTRAINT `Stockcontrol_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_2` FOREIGN KEY (`Id_Remitente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_3` FOREIGN KEY (`Id_Solver`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23250 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5184,13 +5702,13 @@ CREATE TABLE `Tickets` ( KEY `Id_Ruta` (`Id_Ruta`), KEY `warehouse_date` (`warehouse_id`,`Fecha`), CONSTRAINT `Tickets_ibfk_1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Tickets_ibfk_10` FOREIGN KEY (`Factura`) REFERENCES `Facturas` (`Id_Factura`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Tickets_ibfk_5` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Tickets_ibfk_6` FOREIGN KEY (`Id_Consigna`) REFERENCES `Consignatarios` (`id_consigna`) ON UPDATE CASCADE, CONSTRAINT `Tickets_ibfk_8` FOREIGN KEY (`Id_Agencia`) REFERENCES `Agencias` (`Id_Agencia`), CONSTRAINT `Tickets_ibfk_9` FOREIGN KEY (`Id_Ruta`) REFERENCES `Rutas` (`Id_Ruta`) ON UPDATE CASCADE, - CONSTRAINT `ticket_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `ticket_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, + CONSTRAINT `tickets_fk10` FOREIGN KEY (`Factura`) REFERENCES `Facturas` (`Id_Factura`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1753139 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5241,7 +5759,7 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`TicketsAfterInsert` AFTER INSERT ON `vn2008`.`Tickets` FOR EACH ROW BEGIN - /* + /* borrar cuando se canvie el insert ticket en la APP mobil */ DECLARE vEmployee INT; SELECT Id_Trabajador INTO vEmployee @@ -5258,7 +5776,7 @@ BEGIN FROM state WHERE `code` = 'DELIVERED'; END IF; - */ + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -5297,7 +5815,7 @@ BEGIN INNER JOIN Paises p ON p.Id = pr.pais_id WHERE Id_Proveedor = NEW.empresa_id; - SELECT VIES INTO vHasVies + SELECT isVies INTO vHasVies FROM vn.`client` WHERE id = OLD.Id_Cliente; @@ -5335,6 +5853,14 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`TicketsAfterUpdate` AFTER UPDATE ON `Tickets` FOR EACH ROW BEGIN + IF NEW.Id_Ruta IS NULL AND OLD.Id_Ruta IS NOT NULL THEN + INSERT INTO vn.routeLog(originFk, userFk, `action`, description) + VALUES (OLD.Id_Ruta, account.userGetId(), 'update', CONCAT('Saca el ticket ', OLD.Id_Ticket, ' de la ruta')); + ELSEIF NOT (NEW.Id_Ruta <=> OLD.Id_Ruta) THEN + INSERT INTO vn.routeLog(originFk, userFk, `action`, description) + VALUES (NEW.Id_Ruta, account.userGetId(), 'update', CONCAT('Añade el ticket ', OLD.Id_Ticket, ' a la ruta')); + END IF; + CALL stock.queueAdd ('ticket', NEW.Id_Ticket, OLD.Id_Ticket); END */;; DELIMITER ; @@ -5365,7 +5891,7 @@ CREATE TABLE `Tickets_dits` ( CONSTRAINT `Tickets_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=56618879 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5414,7 +5940,7 @@ CREATE TABLE `Tickets_turno` ( `weekDay` tinyint(1) DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', PRIMARY KEY (`Id_Ticket`), CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1751532 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5463,7 +5989,7 @@ CREATE TABLE `Tipos` ( `top_margin` double NOT NULL DEFAULT '0.3', `profit` double NOT NULL DEFAULT '0.02', `FV` tinyint(3) DEFAULT '1', - `density` double NOT NULL DEFAULT '167' COMMENT 'Almacena la densidad en kg/m3 para el calculo de los portes aereos', + `density` double NOT NULL DEFAULT '167' COMMENT 'Almacena el valor por defecto de la densidad en kg/m3 para el calculo de los portes aereos, en articulos se guarda la correcta', `promo` double NOT NULL DEFAULT '0', `box` tinyint(4) NOT NULL DEFAULT '0', `CYM` int(11) NOT NULL DEFAULT '0', @@ -5477,7 +6003,7 @@ CREATE TABLE `Tipos` ( CONSTRAINT `Tipos_fk3` FOREIGN KEY (`confeccion`) REFERENCES `vn`.`confectionType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Tipos_ibfk_1` FOREIGN KEY (`reino_id`) REFERENCES `reinos` (`id`) ON UPDATE CASCADE, CONSTRAINT `Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; +) ENGINE=InnoDB AUTO_INCREMENT=222 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5520,7 +6046,7 @@ CREATE TABLE `Tipos_f11` ( `f11_id` tinyint(4) NOT NULL AUTO_INCREMENT, `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`f11_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5531,12 +6057,12 @@ DROP TABLE IF EXISTS `Trabajadores`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Trabajadores` ( + `Id_Trabajador` int(11) NOT NULL AUTO_INCREMENT, `CodigoTrabajador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, `Nombre` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `Apellidos` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `Password` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `Id_Trabajador` int(11) NOT NULL AUTO_INCREMENT, `extension` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `sub` int(11) unsigned DEFAULT NULL, `user` varchar(20) CHARACTER SET utf8 DEFAULT NULL, @@ -5564,7 +6090,7 @@ CREATE TABLE `Trabajadores` ( KEY `sub` (`sub`), CONSTRAINT `Clientes` FOREIGN KEY (`Id_Cliente_Interno`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1046 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5573,21 +6099,16 @@ CREATE TABLE `Trabajadores` ( /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Trabajadores_BEFORE_INSERT` BEFORE INSERT ON `Trabajadores` FOR EACH ROW - -begin - -IF NEW.password = '' THEN - - SET NEW.password = 'FALLO'; - - END IF; - - - -end */;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`TrabajadoresBeforeInsert` + BEFORE INSERT ON `Trabajadores` + FOR EACH ROW +BEGIN + IF NEW.password = '' THEN + SET NEW.password = 'FALLO'; + END IF; +END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -5600,21 +6121,16 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Trabajadores_BEFORE_UPDATE` BEFORE UPDATE ON `Trabajadores` FOR EACH ROW - -begin - -IF NEW.password = '' THEN - - SET NEW.password = 'FALLO'; - - END IF; - - - -end */;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`TrabajadoresBeforeUpdate` + BEFORE UPDATE ON `Trabajadores` + FOR EACH ROW +BEGIN + IF NEW.password = '' THEN + SET NEW.password = 'FALLO'; + END IF; +END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -5655,28 +6171,29 @@ CREATE TABLE `Ubicator` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `V_edi_item_track` +-- Temporary table structure for view `V_edi_item_track` -- DROP TABLE IF EXISTS `V_edi_item_track`; /*!50001 DROP VIEW IF EXISTS `V_edi_item_track`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `V_edi_item_track` AS SELECT - 1 AS `item_id`, - 1 AS `s1`, - 1 AS `s2`, - 1 AS `s3`, - 1 AS `s4`, - 1 AS `s5`, - 1 AS `s6`, - 1 AS `kop`, - 1 AS `pac`, - 1 AS `cat`, - 1 AS `ori`, - 1 AS `pro`, - 1 AS `sub`, - 1 AS `package`*/; +/*!50001 CREATE TABLE `V_edi_item_track` ( + `item_id` tinyint NOT NULL, + `s1` tinyint NOT NULL, + `s2` tinyint NOT NULL, + `s3` tinyint NOT NULL, + `s4` tinyint NOT NULL, + `s5` tinyint NOT NULL, + `s6` tinyint NOT NULL, + `kop` tinyint NOT NULL, + `pac` tinyint NOT NULL, + `cat` tinyint NOT NULL, + `ori` tinyint NOT NULL, + `pro` tinyint NOT NULL, + `sub` tinyint NOT NULL, + `package` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -5701,7 +6218,7 @@ CREATE TABLE `Vehiculos` ( KEY `provinceFk_idx` (`warehouseFk`), CONSTRAINT `Vehiculos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=363 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5727,24 +6244,25 @@ CREATE TABLE `Vehiculos_consumo` ( PRIMARY KEY (`Vehiculos_consumo_id`,`Id_Vehiculo`), KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`Id_Vehiculo`), CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `Vehiculos` (`Id_Vehiculo`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_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'; +) ENGINE=InnoDB AUTO_INCREMENT=7102 DEFAULT CHARSET=utf8 COLLATE=utf8_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 view structure for view `VerEspionaje` +-- Temporary table structure for view `VerEspionaje` -- DROP TABLE IF EXISTS `VerEspionaje`; /*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `VerEspionaje` AS SELECT - 1 AS `CodigoTrabajador`, - 1 AS `Fecha`, - 1 AS `HoraEntrada`, - 1 AS `HoraSalida`, - 1 AS `Id_Equipo`, - 1 AS `Id_Trabajador`*/; +/*!50001 CREATE TABLE `VerEspionaje` ( + `CodigoTrabajador` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `HoraEntrada` tinyint NOT NULL, + `HoraSalida` tinyint NOT NULL, + `Id_Equipo` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -5760,7 +6278,7 @@ CREATE TABLE `Vistas` ( `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`vista_id`), UNIQUE KEY `code` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5839,7 +6357,7 @@ CREATE TABLE `XDiario` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3158852 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5914,7 +6432,7 @@ CREATE TABLE `XDiario_KK` ( `FECHA_RT` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5951,7 +6469,7 @@ CREATE TABLE `accion_dits` ( `accion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idaccion_dits`), UNIQUE KEY `accion_UNIQUE` (`accion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=166 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5976,7 +6494,7 @@ CREATE TABLE `account_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 `Proveedores_account` (`Id_Proveedores_account`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=28304 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6006,20 +6524,21 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `account_customer` +-- Temporary table structure for view `account_customer` -- DROP TABLE IF EXISTS `account_customer`; /*!50001 DROP VIEW IF EXISTS `account_customer`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `account_customer` AS SELECT - 1 AS `description`, - 1 AS `iban`, - 1 AS `entity_id`, - 1 AS `office`, - 1 AS `dc`, - 1 AS `number`*/; +/*!50001 CREATE TABLE `account_customer` ( + `description` tinyint NOT NULL, + `iban` tinyint NOT NULL, + `entity_id` tinyint NOT NULL, + `office` tinyint NOT NULL, + `dc` tinyint NOT NULL, + `number` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -6039,7 +6558,7 @@ CREATE TABLE `account_detail` ( 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 `Proveedores_account` (`Id_Proveedores_account`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6053,7 +6572,7 @@ CREATE TABLE `account_detail_type` ( `account_detail_type_id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`account_detail_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6071,7 +6590,7 @@ CREATE TABLE `accumulatorsReadingDate` ( PRIMARY KEY (`id`), KEY `pagoSdcFk_idx` (`pagoSdcfk`), CONSTRAINT `pagoSdcFk` FOREIGN KEY (`pagoSdcfk`) REFERENCES `pago_sdc` (`pago_sdc_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=271 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6114,7 +6633,7 @@ CREATE TABLE `agency` ( KEY `agencias_alias_idx` (`warehouse_alias_id`), CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=227 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6160,7 +6679,7 @@ CREATE TABLE `agency_hour` ( CONSTRAINT `agency_hour_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `agency` (`agency_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4274 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6254,8 +6773,9 @@ CREATE TABLE `agency_weekday_bonus` ( `weekDay` tinyint(3) unsigned NOT NULL, `zona` tinyint(4) DEFAULT NULL, `bonus` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + PRIMARY KEY (`id`), + UNIQUE KEY `warehouse_id` (`warehouse_id`,`agency_id`,`weekDay`,`zona`) +) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6269,7 +6789,7 @@ CREATE TABLE `airline` ( `airline_id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`airline_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6325,7 +6845,7 @@ CREATE TABLE `albaran` ( CONSTRAINT `fk_albaran_empresa1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2012 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6357,7 +6877,7 @@ CREATE TABLE `albaran_state` ( `albaran_state_id` int(11) NOT NULL AUTO_INCREMENT, `state` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`albaran_state_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6388,14 +6908,20 @@ CREATE TABLE `awb` ( `booked` datetime DEFAULT NULL, `issued` datetime DEFAULT NULL, `operated` datetime DEFAULT NULL, + `bookEntried` date DEFAULT NULL, + `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, + `isChecked` tinyint(3) DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `codigo_UNIQUE` (`codigo`), KEY `proveedor_id` (`transitario_id`), KEY `iva_id` (`iva_id`), KEY `carguera_id` (`carguera_id`), KEY `flight_id` (`flight_id`), + KEY `awbInvoiceIn` (`invoiceInFk`), + CONSTRAINT `awbInvoiceIn` FOREIGN KEY (`invoiceInFk`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `awbTransitoryFk` FOREIGN KEY (`transitario_id`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2336 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6506,7 +7032,7 @@ CREATE TABLE `awb_component_template` ( CONSTRAINT `Id_Moneda` FOREIGN KEY (`Id_Moneda`) REFERENCES `Monedas` (`Id_Moneda`) 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=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=458 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6520,7 +7046,7 @@ CREATE TABLE `awb_component_type` ( `awb_component_type_id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`awb_component_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT=' '; +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT=' '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6539,7 +7065,7 @@ CREATE TABLE `awb_gestdoc` ( KEY `awb_gestdoc_gestdoc_fk` (`gestdoc_id`), CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awb_id`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2036 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6594,7 +7120,7 @@ CREATE TABLE `awb_role` ( `awb_role_id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`awb_role_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT=' '; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT=' '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6612,16 +7138,17 @@ CREATE TABLE `awb_unit` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `awb_volume` +-- Temporary table structure for view `awb_volume` -- DROP TABLE IF EXISTS `awb_volume`; /*!50001 DROP VIEW IF EXISTS `awb_volume`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `awb_volume` AS SELECT - 1 AS `awb_id`, - 1 AS `volume`*/; +/*!50001 CREATE TABLE `awb_volume` ( + `awb_id` tinyint NOT NULL, + `volume` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -6636,9 +7163,9 @@ CREATE TABLE `balance_nest_tree` ( `rgt` int(11) DEFAULT NULL, `name` text COLLATE utf8_unicode_ci, `id` int(11) NOT NULL AUTO_INCREMENT, - `Id_Gasto` text COLLATE utf8_unicode_ci, + `Id_Gasto` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=383 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6657,7 +7184,7 @@ CREATE TABLE `barcodes` ( UNIQUE KEY `Id_Article_2` (`Id_Article`,`code`), KEY `Id_Article` (`Id_Article`), CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=33670 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6671,7 +7198,7 @@ CREATE TABLE `bionic_updating_options` ( `buo_id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`buo_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla pondremos las distintas opciones que se ofrecen al comecial o al cliente al cambiar alguno de los parametros básicos de un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla pondremos las distintas opciones que se ofrecen al comecial o al cliente al cambiar alguno de los parametros básicos de un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6691,7 +7218,7 @@ CREATE TABLE `botanic_export` ( PRIMARY KEY (`botanic_export_id`), KEY `Id_Paises` (`Id_Paises`), CONSTRAINT `botanic_export_ibfk_1` FOREIGN KEY (`Id_Paises`) REFERENCES `Paises` (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; +) ENGINE=InnoDB AUTO_INCREMENT=274 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6725,7 +7252,7 @@ CREATE TABLE `businessReasonEnd` ( `id` tinyint(3) NOT NULL AUTO_INCREMENT, `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6796,8 +7323,9 @@ CREATE TABLE `buy_edi` ( KEY `ptj` (`ptj`), KEY `pro` (`pro`), KEY `kop` (`kop`), - KEY `barcode` (`barcode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `barcode` (`barcode`), + KEY `fec` (`fec`) +) ENGINE=InnoDB AUTO_INCREMENT=634105 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6856,7 +7384,7 @@ CREATE TABLE `call_information` ( `Id_Cliente` int(11) NOT NULL, `fecha` date NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=164 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6870,7 +7398,7 @@ CREATE TABLE `call_option` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `descripcion` varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6912,30 +7440,31 @@ CREATE TABLE `callingtasksKK` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `cdr` +-- Temporary table structure for view `cdr` -- DROP TABLE IF EXISTS `cdr`; /*!50001 DROP VIEW IF EXISTS `cdr`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `cdr` AS SELECT - 1 AS `calldate`, - 1 AS `clid`, - 1 AS `src`, - 1 AS `dst`, - 1 AS `dcontext`, - 1 AS `channel`, - 1 AS `dstchannel`, - 1 AS `lastapp`, - 1 AS `lastdata`, - 1 AS `duration`, - 1 AS `billsec`, - 1 AS `disposition`, - 1 AS `amaflags`, - 1 AS `accountcode`, - 1 AS `uniqueid`, - 1 AS `userfield`*/; +/*!50001 CREATE TABLE `cdr` ( + `calldate` tinyint NOT NULL, + `clid` tinyint NOT NULL, + `src` tinyint NOT NULL, + `dst` tinyint NOT NULL, + `dcontext` tinyint NOT NULL, + `channel` tinyint NOT NULL, + `dstchannel` tinyint NOT NULL, + `lastapp` tinyint NOT NULL, + `lastdata` tinyint NOT NULL, + `duration` tinyint NOT NULL, + `billsec` tinyint NOT NULL, + `disposition` tinyint NOT NULL, + `amaflags` tinyint NOT NULL, + `accountcode` tinyint NOT NULL, + `uniqueid` tinyint NOT NULL, + `userfield` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -6949,7 +7478,7 @@ CREATE TABLE `chanel` ( `chanel_id` smallint(6) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`chanel_id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Canal por el que nos ha conocido un cliente y se ha dado de'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6986,7 +7515,7 @@ CREATE TABLE `city` ( KEY `NST_CITY_FK_idx` (`nst_geo_id`), CONSTRAINT `nst_geo_city` FOREIGN KEY (`nst_geo_id`) REFERENCES `nst`.`geo` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `province_city_fk` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4423 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -7051,7 +7580,7 @@ CREATE TABLE `cl_act` ( CONSTRAINT `cl_act_ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_4` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=76404 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7085,7 +7614,7 @@ CREATE TABLE `cl_cau` ( CONSTRAINT `cl_cau_ibfk_7` FOREIGN KEY (`cl_mot_id`) REFERENCES `cl_mot` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_8` FOREIGN KEY (`cl_con_id`) REFERENCES `cl_con` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_9` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=42673 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7099,7 +7628,7 @@ CREATE TABLE `cl_con` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `consecuencia` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Consecuencias de los motivos'; +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Consecuencias de los motivos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7113,7 +7642,7 @@ CREATE TABLE `cl_dep` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `departamento` varchar(20) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Departamentos para las quejas'; +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Departamentos para las quejas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7139,7 +7668,7 @@ CREATE TABLE `cl_det` ( CONSTRAINT `cl_det_ibfk_6` FOREIGN KEY (`cl_pet_id`) REFERENCES `cl_pet` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_det_ibfk_7` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_det_ibfk_8` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=105982 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7153,7 +7682,7 @@ CREATE TABLE `cl_dev` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `devolucion` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Método por el cual el cliente nos devuelve la mercancía'; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Método por el cual el cliente nos devuelve la mercancía'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7167,7 +7696,7 @@ CREATE TABLE `cl_est` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `estado` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Estados posibles de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Estados posibles de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7196,7 +7725,7 @@ CREATE TABLE `cl_main` ( CONSTRAINT `cl_main_ibfk_3` FOREIGN KEY (`cl_est_id`) REFERENCES `cl_est` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_main_ibfk_4` FOREIGN KEY (`cl_dep_id`) REFERENCES `cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_main_ibfk_5` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDB AUTO_INCREMENT=45089 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7210,7 +7739,7 @@ CREATE TABLE `cl_mot` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `motivo` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Motivos de las fallos'; +) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Motivos de las fallos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7224,7 +7753,7 @@ CREATE TABLE `cl_pet` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `peticion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Peticiones de los cliente en relacion a las quejas'; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Peticiones de los cliente en relacion a las quejas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7238,7 +7767,7 @@ CREATE TABLE `cl_que` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `queja` varchar(25) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queja por linea de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queja por linea de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7253,7 +7782,7 @@ CREATE TABLE `cl_res` ( `responsable` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `sensibility` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'if=1 >sensib >culpa', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Responsables de las causas'; +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Responsables de las causas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7267,28 +7796,29 @@ CREATE TABLE `cl_sol` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `solucion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Solucion ofrecida a la reclamación'; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Solucion ofrecida a la reclamación'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `clientMana` +-- Temporary table structure for view `clientMana` -- DROP TABLE IF EXISTS `clientMana`; /*!50001 DROP VIEW IF EXISTS `clientMana`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientMana` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `ManaUnitario`, - 1 AS `ManaTotal`, - 1 AS `Id_Ticket`, - 1 AS `Id_Article`, - 1 AS `Concepte`, - 1 AS `Cantidad`, - 1 AS `Preu`, - 1 AS `Fecha`, - 1 AS `Id_Movimiento`*/; +/*!50001 CREATE TABLE `clientMana` ( + `Id_Cliente` tinyint NOT NULL, + `ManaUnitario` tinyint NOT NULL, + `ManaTotal` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `Concepte` tinyint NOT NULL, + `Cantidad` tinyint NOT NULL, + `Preu` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -7309,7 +7839,7 @@ CREATE TABLE `client_observation` ( KEY `Id_Cliente` (`Id_Cliente`), CONSTRAINT `client_observation_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `client_observation_ibfk_2` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=55439 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7361,7 +7891,7 @@ CREATE TABLE `clientes_regalos_lista_enc` ( `warehouse_id` smallint(6) unsigned DEFAULT '1', `province_id` smallint(5) unsigned DEFAULT NULL, PRIMARY KEY (`Id_Regalo`) -) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7377,7 +7907,7 @@ CREATE TABLE `clientes_tipo` ( `tipo` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`clientes_tipo_id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7473,7 +8003,7 @@ CREATE TABLE `consignatarios_observation` ( `text` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`consignatarios_observation_id`), UNIQUE KEY `Id_Consigna` (`Id_Consigna`,`observation_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDB AUTO_INCREMENT=2880 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7487,7 +8017,7 @@ CREATE TABLE `container` ( `container_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `Continente` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`container_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7501,7 +8031,7 @@ CREATE TABLE `cooler_path` ( `cooler_path_id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`cooler_path_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define el orden en que se imprimen los F5'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define el orden en que se imprimen los F5'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7517,7 +8047,7 @@ CREATE TABLE `cooler_path_detail` ( `pasillo` varchar(3) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`cooler_path_id`,`pasillo`), UNIQUE KEY `cooler_path_detail_id_UNIQUE` (`cooler_path_detail_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=94 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7534,7 +8064,7 @@ CREATE TABLE `cp` ( `zone_id` smallint(6) DEFAULT NULL, `town` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`cp_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna'; +) ENGINE=InnoDB AUTO_INCREMENT=77 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7552,8 +8082,10 @@ CREATE TABLE `credit` ( `Id_Trabajador` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `workers_fk_idx` (`Id_Trabajador`), + KEY `credit_ClienteFk` (`Id_Cliente`), + CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=58560 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7574,7 +8106,7 @@ CREATE TABLE `credit_card` ( PRIMARY KEY (`credit_card_id`), KEY `Id_Cliente` (`Id_Cliente`), CONSTRAINT `credit_card_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=956 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7592,7 +8124,7 @@ CREATE TABLE `cyc` ( PRIMARY KEY (`cyc_id`), KEY `Cliente` (`Id_Cliente`), CONSTRAINT `Cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que estan clasificados en Credito y Cau'; +) ENGINE=InnoDB AUTO_INCREMENT=467096 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que estan clasificados en Credito y Cau'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7661,7 +8193,7 @@ CREATE TABLE `department` ( UNIQUE KEY `name_UNIQUE` (`name`), KEY `fk_department_Trabajadores1_idx` (`Id_Trabajador`), CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7678,7 +8210,7 @@ CREATE TABLE `device` ( PRIMARY KEY (`device_id`), UNIQUE KEY `device_id_UNIQUE` (`device_id`), UNIQUE KEY `sn_UNIQUE` (`sn`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=177 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7709,6 +8241,23 @@ CREATE TABLE `dhl` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `dock` +-- + +DROP TABLE IF EXISTS `dock`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `dock` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(5) COLLATE utf8_unicode_ci NOT NULL, + `xPos` int(11) DEFAULT NULL, + `yPos` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `code_UNIQUE` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Soporta la estructura de muelles de paletizacion'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `duaDismissed` -- @@ -7720,160 +8269,169 @@ CREATE TABLE `duaDismissed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`,`ticketFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `edi_article` +-- Temporary table structure for view `edi_article` -- DROP TABLE IF EXISTS `edi_article`; /*!50001 DROP VIEW IF EXISTS `edi_article`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_article` AS SELECT - 1 AS `id`, - 1 AS `product_name`, - 1 AS `name`, - 1 AS `plant_id`, - 1 AS `group_id`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time`*/; +/*!50001 CREATE TABLE `edi_article` ( + `id` tinyint NOT NULL, + `product_name` tinyint NOT NULL, + `name` tinyint NOT NULL, + `plant_id` tinyint NOT NULL, + `group_id` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_bucket` +-- Temporary table structure for view `edi_bucket` -- DROP TABLE IF EXISTS `edi_bucket`; /*!50001 DROP VIEW IF EXISTS `edi_bucket`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_bucket` AS SELECT - 1 AS `bucket_id`, - 1 AS `bucket_type_id`, - 1 AS `description`, - 1 AS `x_size`, - 1 AS `y_size`, - 1 AS `z_size`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time`*/; +/*!50001 CREATE TABLE `edi_bucket` ( + `bucket_id` tinyint NOT NULL, + `bucket_type_id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `x_size` tinyint NOT NULL, + `y_size` tinyint NOT NULL, + `z_size` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_bucket_type` +-- Temporary table structure for view `edi_bucket_type` -- DROP TABLE IF EXISTS `edi_bucket_type`; /*!50001 DROP VIEW IF EXISTS `edi_bucket_type`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_bucket_type` AS SELECT - 1 AS `bucket_type_id`, - 1 AS `description`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time`*/; +/*!50001 CREATE TABLE `edi_bucket_type` ( + `bucket_type_id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_feature` +-- 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`*/; +/*!50001 CREATE TABLE `edi_feature` ( + `item_id` tinyint NOT NULL, + `feature_type_id` tinyint NOT NULL, + `feature_value` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_genus` +-- 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`*/; +/*!50001 CREATE TABLE `edi_genus` ( + `genus_id` tinyint NOT NULL, + `latin_genus_name` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_item_feature` +-- 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`*/; +/*!50001 CREATE TABLE `edi_item_feature` ( + `item_id` tinyint NOT NULL, + `presentation_order` tinyint NOT NULL, + `feature` tinyint NOT NULL, + `regulation_type` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_plant` +-- 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`*/; +/*!50001 CREATE TABLE `edi_plant` ( + `plant_id` tinyint NOT NULL, + `genus_id` tinyint NOT NULL, + `specie_id` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_specie` +-- Temporary table structure for view `edi_specie` -- DROP TABLE IF EXISTS `edi_specie`; /*!50001 DROP VIEW IF EXISTS `edi_specie`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_specie` AS SELECT - 1 AS `specie_id`, - 1 AS `genus_id`, - 1 AS `latin_species_name`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time`*/; +/*!50001 CREATE TABLE `edi_specie` ( + `specie_id` tinyint NOT NULL, + `genus_id` tinyint NOT NULL, + `latin_species_name` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_supplier` +-- Temporary table structure for view `edi_supplier` -- DROP TABLE IF EXISTS `edi_supplier`; /*!50001 DROP VIEW IF EXISTS `edi_supplier`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_supplier` AS SELECT - 1 AS `supplier_id`, - 1 AS `company_name`*/; +/*!50001 CREATE TABLE `edi_supplier` ( + `supplier_id` tinyint NOT NULL, + `company_name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -7889,41 +8447,43 @@ CREATE TABLE `edi_testigos` ( `field` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `testigo` varchar(5) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `edi_type` +-- Temporary table structure for view `edi_type` -- 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`*/; +/*!50001 CREATE TABLE `edi_type` ( + `type_id` tinyint NOT NULL, + `type_group_id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `edi_value` +-- 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`*/; +/*!50001 CREATE TABLE `edi_value` ( + `type_id` tinyint NOT NULL, + `type_value` tinyint NOT NULL, + `type_description` tinyint NOT NULL, + `entry_date` tinyint NOT NULL, + `expiry_date` tinyint NOT NULL, + `change_date_time` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -7966,6 +8526,7 @@ CREATE TABLE `empresa` ( `Id_Proveedores_account` mediumint(8) unsigned DEFAULT NULL, `morosidad` tinyint(4) NOT NULL DEFAULT '0', `empresa_grupo` int(11) NOT NULL DEFAULT '1', + `CodigoEmpresa` int(2) DEFAULT NULL COMMENT 'Campo para movConta', PRIMARY KEY (`id`), KEY `gerente_id` (`gerente_id`), KEY `empresa_cliente_idx` (`Id_Cliente`), @@ -7988,7 +8549,7 @@ CREATE TABLE `empresa_grupo` ( `empresa_grupo_id` int(11) NOT NULL AUTO_INCREMENT, `grupo` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`empresa_grupo_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8000,15 +8561,14 @@ DROP TABLE IF EXISTS `entity`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `entity` ( `pais_id` mediumint(8) unsigned NOT NULL DEFAULT '1', - `entity_id` int(10) unsigned NOT NULL, + `entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `bic` varchar(11) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`entity_id`), - UNIQUE KEY `entity_id_UNIQUE` (`entity_id`), UNIQUE KEY `bic_UNIQUE` (`bic`), KEY `fg_entity1_idx` (`pais_id`), CONSTRAINT `fg_entity1` FOREIGN KEY (`pais_id`) REFERENCES `Paises` (`Id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; +) ENGINE=InnoDB AUTO_INCREMENT=10229 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8020,11 +8580,11 @@ DROP TABLE IF EXISTS `escritos`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `escritos` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `abrev` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `abrev` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `descripcion` varchar(105) COLLATE utf8_unicode_ci NOT NULL, `visible` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8042,10 +8602,12 @@ CREATE TABLE `escritos_det` ( `Id_Trabajador` int(10) unsigned NOT NULL, `Saldo` float NOT NULL, `empresa_id` smallint(5) unsigned DEFAULT NULL, + `escritos_detcol` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `userFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `escritos_det_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14453 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8072,8 +8634,9 @@ CREATE TABLE `expeditions` ( KEY `index2` (`EsBulto`), KEY `index3` (`odbc_date`), KEY `index4` (`ticket_id`), - CONSTRAINT `Id_Agencia` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `Id_Agencia` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, + CONSTRAINT `ticket_id` FOREIGN KEY (`ticket_id`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2209183 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8176,7 +8739,7 @@ BEGIN UPDATE Tickets SET Bultos = (SELECT COUNT(counter)-1 FROM expeditions WHERE ticket_id = OLD.ticket_id and EsBulto) WHERE Id_Ticket = OLD.ticket_id; INSERT INTO Tickets_dits (idaccion_dits,Id_Trabajador,Id_Ticket,value_old,value_new) - SELECT 133/*Borra expedition*/ ,trabajador,OLD.ticket_id,CONCAT(OLD.odbc_date,',Bultos:',OLD.counter,',Embalaje:',OLD.EsBulto),user() + SELECT 133/*Borra expedition*/,trabajador,OLD.ticket_id,CONCAT(OLD.odbc_date,',Bultos:',OLD.counter,',Embalaje:',OLD.EsBulto),user() FROM Tickets WHERE Id_Ticket = OLD.ticket_id ; @@ -8213,7 +8776,7 @@ CREATE TABLE `expeditions_deleted` ( KEY `index2` (`EsBulto`), KEY `index3` (`odbc_date`), KEY `index4` (`ticket_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2208973 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8243,7 +8806,7 @@ CREATE TABLE `filtros` ( `sql` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `Estanteria` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8294,7 +8857,7 @@ CREATE TABLE `form_query` ( `response2` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `type_id` enum('gest_doc') COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`form_query_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8338,7 +8901,7 @@ CREATE TABLE `gestdoc` ( UNIQUE KEY `emp_id` (`emp_id`,`orden`,`warehouse_id`), KEY `trabajador_id` (`trabajador_id`), KEY `warehouse_id` (`warehouse_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=802254 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8417,7 +8980,7 @@ CREATE TABLE `gesttip` ( `tipo` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8537,7 +9100,7 @@ CREATE TABLE `intrastat_data` ( KEY `recibida` (`recibida_id`), CONSTRAINT `intrastat_data_ibfk_1` FOREIGN KEY (`intrastat_id`) REFERENCES `Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `intrastat_data_ibfk_2` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=61688 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8581,52 +9144,50 @@ CREATE TABLE `invoice_observation` ( `empresa_id` smallint(5) unsigned NOT NULL DEFAULT '0', `text` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`invoice_observation_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `itemTag` +-- Temporary table structure for view `itemTag` -- DROP TABLE IF EXISTS `itemTag`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemTag` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) NOT NULL, - `tagFk` int(11) NOT NULL, - `value` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `priority` int(2) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `tag_fk_idx` (`tagFk`), - KEY `priorityItem` (`itemFk`,`priority`), - CONSTRAINT `itemFK` FOREIGN KEY (`itemFk`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `itemTag`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemTag` ( + `id` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `tagFk` tinyint NOT NULL, + `value` tinyint NOT NULL, + `priority` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemTagArranged` +-- Temporary table structure for view `itemTagArranged` -- DROP TABLE IF EXISTS `itemTagArranged`; /*!50001 DROP VIEW IF EXISTS `itemTagArranged`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemTagArranged` AS SELECT - 1 AS `itemFk`, - 1 AS `tag1`, - 1 AS `val1`, - 1 AS `tag2`, - 1 AS `val2`, - 1 AS `tag3`, - 1 AS `val3`, - 1 AS `tag4`, - 1 AS `val4`, - 1 AS `tag5`, - 1 AS `val5`, - 1 AS `tag6`, - 1 AS `val6`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `itemTagArranged` ( + `itemFk` tinyint NOT NULL, + `tag1` tinyint NOT NULL, + `val1` tinyint NOT NULL, + `tag2` tinyint NOT NULL, + `val2` tinyint NOT NULL, + `tag3` tinyint NOT NULL, + `val3` tinyint NOT NULL, + `tag4` tinyint NOT NULL, + `val4` tinyint NOT NULL, + `tag5` tinyint NOT NULL, + `val5` tinyint NOT NULL, + `tag6` tinyint NOT NULL, + `val6` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -8643,61 +9204,81 @@ CREATE TABLE `item_catalog` ( `price` double DEFAULT NULL, `s1` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, `s2` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `discount` tinyint(3) unsigned DEFAULT NULL, + `discount` tinyint(3) unsigned, `grouping` decimal(10,0) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `item_entry_in` +-- 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 `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `received`*/; +/*!50001 CREATE TABLE `item_entry_in` ( + `warehouse_id` tinyint NOT NULL, + `dat` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `received` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `item_entry_out` +-- 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`*/; +/*!50001 CREATE TABLE `item_entry_out` ( + `warehouse_id` tinyint NOT NULL, + `dat` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `delivered` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `item_out` +-- Temporary table structure for view `item_entry_outkk` +-- + +DROP TABLE IF EXISTS `item_entry_outkk`; +/*!50001 DROP VIEW IF EXISTS `item_entry_outkk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `item_entry_outkk` ( + `warehouse_id` tinyint NOT NULL, + `dat` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `delivered` tinyint NOT NULL +) ENGINE=MyISAM */; +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 `ready`, - 1 AS `invoice`, - 1 AS `alertLevel`*/; +/*!50001 CREATE TABLE `item_out` ( + `warehouse_id` tinyint NOT NULL, + `dat` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `ok` tinyint NOT NULL, + `Reservado` tinyint NOT NULL, + `ready` tinyint NOT NULL, + `invoice` tinyint NOT NULL, + `alertLevel` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -8712,17 +9293,19 @@ CREATE TABLE `iva_codigo` ( `fecha` date NOT NULL, `codigo` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `iva_tipo_id` tinyint(2) NOT NULL, - `iva` float(3,1) NOT NULL DEFAULT '0.0', - `recargo` float(2,1) NOT NULL DEFAULT '0.0', + `iva` decimal(4,1) NOT NULL DEFAULT '0.0', + `recargo` decimal(4,1) NOT NULL DEFAULT '0.0', `tipo` char(1) COLLATE utf8_unicode_ci NOT NULL, `link` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'las que tienen el mismo valor se contabilizan emparejadas', `isActive` tinyint(2) NOT NULL DEFAULT '1', + `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `transactionCode` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `iva_tipo_id` (`iva_tipo_id`), KEY `codigo` (`codigo`), KEY `tipo_index` (`tipo`), CONSTRAINT `iva_codigo_ibfk_1` FOREIGN KEY (`iva_tipo_id`) REFERENCES `iva_tipo` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=121 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8737,7 +9320,7 @@ CREATE TABLE `iva_group` ( `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'R', PRIMARY KEY (`iva_group_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8768,6 +9351,7 @@ DROP TABLE IF EXISTS `iva_tipo`; CREATE TABLE `iva_tipo` ( `id` tinyint(2) NOT NULL AUTO_INCREMENT, `alias` varchar(6) COLLATE utf8_unicode_ci NOT NULL, + `isAccrued` tinyint(4) NOT NULL DEFAULT '0', `serie_id` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, `TIPOOPE` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT ' ', `descripcion` varchar(100) COLLATE utf8_unicode_ci NOT NULL, @@ -8776,7 +9360,7 @@ CREATE TABLE `iva_tipo` ( KEY `serie_id` (`serie_id`), KEY `Id_Pais` (`Id_Pais`), CONSTRAINT `iva_tipo_ibfk_1` FOREIGN KEY (`Id_Pais`) REFERENCES `Paises` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8888,7 +9472,7 @@ CREATE TABLE `mail` ( `recipientFk` int(11) DEFAULT NULL, `plainTextBody` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1136979 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=1232795 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8906,7 +9490,7 @@ CREATE TABLE `mail_templates` ( `body` text COLLATE utf8_unicode_ci NOT NULL, `attachment` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`,`countryCode`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8931,7 +9515,7 @@ CREATE TABLE `mandato` ( CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`idmandato_tipo`) REFERENCES `mandato_tipo` (`idmandato_tipo`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14235 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8969,7 +9553,7 @@ CREATE TABLE `mandato_tipo` ( `idmandato_tipo` smallint(5) NOT NULL AUTO_INCREMENT, `Nombre` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`idmandato_tipo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9008,17 +9592,18 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `new_view` +-- Temporary table structure for view `new_viewkk` -- -DROP TABLE IF EXISTS `new_view`; -/*!50001 DROP VIEW IF EXISTS `new_view`*/; +DROP TABLE IF EXISTS `new_viewkk`; +/*!50001 DROP VIEW IF EXISTS `new_viewkk`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `new_view` AS SELECT - 1 AS `id`, - 1 AS `worker`, - 1 AS `document`*/; +/*!50001 CREATE TABLE `new_viewkk` ( + `id` tinyint NOT NULL, + `worker` tinyint NOT NULL, + `document` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -9045,29 +9630,30 @@ CREATE TABLE `observation_type` ( `observation_type_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`observation_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `order` +-- Temporary table structure for view `order` -- DROP TABLE IF EXISTS `order`; /*!50001 DROP VIEW IF EXISTS `order`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `order` AS SELECT - 1 AS `id`, - 1 AS `date_make`, - 1 AS `date_send`, - 1 AS `customer_id`, - 1 AS `delivery_method_id`, - 1 AS `agency_id`, - 1 AS `address_id`, - 1 AS `note`, - 1 AS `confirmed`, - 1 AS `is_bionic`, - 1 AS `source_app`*/; +/*!50001 CREATE TABLE `order` ( + `id` tinyint NOT NULL, + `date_make` tinyint NOT NULL, + `date_send` tinyint NOT NULL, + `customer_id` tinyint NOT NULL, + `delivery_method_id` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `address_id` tinyint NOT NULL, + `note` tinyint NOT NULL, + `confirmed` tinyint NOT NULL, + `is_bionic` tinyint NOT NULL, + `source_app` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -9086,38 +9672,40 @@ CREATE TABLE `order_Tickets` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `order_component` +-- Temporary table structure for view `order_component` -- DROP TABLE IF EXISTS `order_component`; /*!50001 DROP VIEW IF EXISTS `order_component`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_component` AS SELECT - 1 AS `order_row_id`, - 1 AS `component_id`, - 1 AS `price`*/; +/*!50001 CREATE TABLE `order_component` ( + `order_row_id` tinyint NOT NULL, + `component_id` tinyint NOT NULL, + `price` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `order_row` +-- Temporary table structure for view `order_row` -- DROP TABLE IF EXISTS `order_row`; /*!50001 DROP VIEW IF EXISTS `order_row`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_row` AS SELECT - 1 AS `id`, - 1 AS `order_id`, - 1 AS `item_id`, - 1 AS `warehouse_id`, - 1 AS `shipment`, - 1 AS `amount`, - 1 AS `price`, - 1 AS `rate`, - 1 AS `created`, - 1 AS `Id_Movimiento`*/; +/*!50001 CREATE TABLE `order_row` ( + `id` tinyint NOT NULL, + `order_id` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `shipment` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `price` tinyint NOT NULL, + `rate` tinyint NOT NULL, + `created` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -9154,7 +9742,7 @@ CREATE TABLE `pago` ( CONSTRAINT `pago_moneda` FOREIGN KEY (`id_moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `pago_pay_met` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`id_proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38926 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9230,12 +9818,12 @@ CREATE TABLE `pago_sdc` ( `strike` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`pago_sdc_id`), KEY `empresa_sdc_idx` (`empresa_id`), - KEY `entity_sdc_idx` (`entity_id`), KEY `financial_type_fk_idx` (`financialProductTypefk`), + KEY `pago_sdc_entity_fk_idx` (`entity_id`), CONSTRAINT `empresa_sdc` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, - CONSTRAINT `entity_sdc` FOREIGN KEY (`entity_id`) REFERENCES `entity` (`entity_id`) ON UPDATE CASCADE, - CONSTRAINT `financial_type_fk` FOREIGN KEY (`financialProductTypefk`) REFERENCES `financialProductType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Seguros de cambio'; + CONSTRAINT `financial_type_fk` FOREIGN KEY (`financialProductTypefk`) REFERENCES `financialProductType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_sdc_entity_fk` FOREIGN KEY (`entity_id`) REFERENCES `entity` (`entity_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Seguros de cambio'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9249,7 +9837,7 @@ CREATE TABLE `pay_dem` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `pay_dem` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9281,7 +9869,7 @@ CREATE TABLE `pay_met` ( `graceDays` int(11) unsigned NOT NULL DEFAULT '0', `ibanRequired` tinyint(3) DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9304,7 +9892,7 @@ CREATE TABLE `payroll_basess` ( KEY `payroll_basess_2_idx` (`empresa_id`), CONSTRAINT `payroll_basess_1` FOREIGN KEY (`id_tipobasess`) REFERENCES `payroll_tipobasess` (`id_payroll_tipobasess`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `payroll_basess_2` FOREIGN KEY (`empresa_id`) REFERENCES `payroll_centros` (`empresa_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9498,7 +10086,7 @@ CREATE TABLE `payroll_tipobasess` ( `id_payroll_tipobasess` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id_payroll_tipobasess`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9519,36 +10107,38 @@ CREATE TABLE `payrroll_apEmpresarial` ( `costeEmpresaFogasa` decimal(8,2) NOT NULL, `costeEmpresaExtra` decimal(8,2) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1654 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `person_user` +-- 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`*/; +/*!50001 CREATE TABLE `person_user` ( + `id` tinyint NOT NULL, + `mysql_user_id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `password` tinyint NOT NULL, + `active` tinyint NOT NULL, + `last_pass_change` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `person_user_idtrabajador` +-- 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`*/; +/*!50001 CREATE TABLE `person_user_idtrabajador` ( + `Id_Trabajador` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -9566,7 +10156,7 @@ CREATE TABLE `plantpassport` ( KEY `plantpassport_authority_idx` (`plantpassport_authority_id`), KEY `producer_id_idx` (`producer_id`), CONSTRAINT `plantpassport_authority` FOREIGN KEY (`plantpassport_authority_id`) REFERENCES `plantpassport_authority` (`plantpassport_authority_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `producer` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `producer` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='tiene la asignacion de cada productor con la autoridad certificadora'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9588,49 +10178,6 @@ CREATE TABLE `plantpassport_authority` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='entidades certificadoras'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `postcodeKK` --- - -DROP TABLE IF EXISTS `postcodeKK`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `postcodeKK` ( - `postcode_id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `city_id` int(11) NOT NULL, - `nst_geo_id` int(11) DEFAULT NULL, - `nst_name` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`postcode_id`), - UNIQUE KEY `code_city` (`code`,`city_id`), - KEY `postal_code_idx` (`code`), - KEY `city_id_pk_idx` (`city_id`), - KEY `nst_geo_pc_id_idx` (`nst_geo_id`), - CONSTRAINT `city_id_pk` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `nst_geo_pc_id` FOREIGN KEY (`nst_geo_id`) REFERENCES `nst`.`geo` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`postcode_BEFORE_INSERT` BEFORE INSERT ON `postcodeKK` FOR EACH ROW -BEGIN - - SET new.nst_name = new.code; - -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 */ ; - -- -- Table structure for table `preparation_exception` -- @@ -9692,7 +10239,7 @@ CREATE TABLE `price_fixed` ( KEY `date_end` (`date_end`), KEY `warehouse_id` (`warehouse_id`), CONSTRAINT `price_fixed_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=51265 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9752,8 +10299,9 @@ CREATE TABLE `producer` ( `producer_id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `visible` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`producer_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + PRIMARY KEY (`producer_id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=3666 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9777,18 +10325,19 @@ CREATE TABLE `profile_labour_payroll` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `proveedores_clientes` +-- Temporary table structure for view `proveedores_clientes` -- DROP TABLE IF EXISTS `proveedores_clientes`; /*!50001 DROP VIEW IF EXISTS `proveedores_clientes`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `proveedores_clientes` AS SELECT - 1 AS `Id_Proveedor`, - 1 AS `Proveedor`, - 1 AS `Id_Cliente`, - 1 AS `Cliente`*/; +/*!50001 CREATE TABLE `proveedores_clientes` ( + `Id_Proveedor` tinyint NOT NULL, + `Proveedor` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `Cliente` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -9828,7 +10377,7 @@ CREATE TABLE `province` ( CONSTRAINT `province_ibfk_1` FOREIGN KEY (`Paises_Id`) REFERENCES `Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `province_zone_fk` FOREIGN KEY (`zone`) REFERENCES `zones` (`zone_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `warehouse_Id` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=192 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9915,6 +10464,7 @@ CREATE TABLE `recibida` ( `cplusSubjectOpFk` int(10) unsigned DEFAULT '1', `cplusTaxBreakFk` int(10) unsigned DEFAULT '1', `cplusTrascendency472Fk` int(10) unsigned DEFAULT '1', + `bookEntried` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `proveedor_id` (`proveedor_id`), KEY `empresa_id` (`empresa_id`), @@ -9934,7 +10484,7 @@ CREATE TABLE `recibida` ( CONSTRAINT `recibida_ibfk_5` FOREIGN KEY (`cplusInvoiceType472Fk`) REFERENCES `vn`.`cplusInvoiceType472` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `vn`.`cplusTrascendency472` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=63478 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9953,6 +10503,7 @@ BEGIN DECLARE v_num_recibida INT; DECLARE pais_emisor, pais_receptor INT; DECLARE vActive TINYINT; + SELECT pais_id, active into pais_emisor, vActive FROM Proveedores WHERE Id_Proveedor = NEW.proveedor_id; SELECT pais_id into pais_receptor FROM Proveedores WHERE Id_Proveedor = NEW.empresa_id; @@ -9980,8 +10531,9 @@ BEGIN AND empresa_id = NEW.empresa_id; SET NEW.num_recibida = v_num_recibida; - END IF; + END IF; + END */;; DELIMITER ; @@ -10013,12 +10565,16 @@ BEGIN IF vActive = 0 THEN CALL util.throw('INACTIVE_PROVIDER'); END IF; - + IF NEW.empresa_id <> OLD.empresa_id THEN SET NEW.num_recibida = NULL; SET NEW.contabilizada = FALSE ; END IF; -/* + + + +/* PAK 27/11/17 ESto tiene pinta de no hacer falta.... + IF NEW.contabilizada = 1 AND OLD.contabilizada = 0 AND NEW.fecha < '2017-07-01' THEN SELECT rate INTO dblRefRate FROM reference_rate WHERE date = (SELECT MAX(date) FROM reference_rate @@ -10365,6 +10921,33 @@ DELIMITER ; /*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`recibida_au` AFTER UPDATE ON `recibida` FOR EACH ROW +BEGIN + + IF NEW.fecha != OLD.fecha + OR + NEW.moneda_id != OLD.moneda_id + THEN + + CALL recibidaIvaDivisaUpdate(NEW.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 */ ; -- -- Table structure for table `recibida_agricola` @@ -10400,7 +10983,7 @@ CREATE TABLE `recibida_entrada` ( KEY `Id_Entrada` (`Id_Entrada`), KEY `recibida_id` (`recibida_id`), CONSTRAINT `recibida_entrada_ibfk_2` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9741 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10488,7 +11071,7 @@ CREATE TABLE `recibida_iva` ( CONSTRAINT `recibida_iva_ibfk_2` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_5` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_6` FOREIGN KEY (`gastos_id`) REFERENCES `Gastos` (`Id_Gasto`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=84342 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10511,7 +11094,7 @@ CREATE TABLE `recibida_vencimiento` ( KEY `banco_id` (`banco_id`), CONSTRAINT `recibida_vencimiento_ibfk_6` FOREIGN KEY (`banco_id`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibida_vencimiento_ibfk_7` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=81951 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10554,7 +11137,7 @@ CREATE TABLE `recovery` ( KEY `cliente_idx` (`Id_Cliente`), CONSTRAINT `cliente333` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `cliente_cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; +) ENGINE=InnoDB AUTO_INCREMENT=246 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10572,7 +11155,7 @@ CREATE TABLE `recovery_asset` ( PRIMARY KEY (`recovery_asset_id`), KEY `Cliente_Recovery_detalle_idx` (`Id_Cliente`), CONSTRAINT `Cliente_Recovery_detalle` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla se registra el detalle de los recobros definid'; +) ENGINE=InnoDB AUTO_INCREMENT=723 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla se registra el detalle de los recobros definid'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10584,8 +11167,9 @@ DROP TABLE IF EXISTS `reference_min`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `reference_min` ( `date` date NOT NULL, - `rate` double NOT NULL, - `moneda_id` tinyint(3) unsigned NOT NULL DEFAULT '2' + `rate` decimal(10,4) NOT NULL, + `moneda_id` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`date`,`moneda_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -10621,7 +11205,7 @@ CREATE TABLE `reinos` ( `efimero` int(11) NOT NULL DEFAULT '0' COMMENT 'Sirve para filtrar aquellos reinos que tienen precios estables', `mercancia` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10650,7 +11234,7 @@ CREATE TABLE `reparacion` ( CONSTRAINT `reparacion_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `reparacion_ibfk_2` FOREIGN KEY (`config_host`) REFERENCES `config_host` (`config_host_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `reparacion_ibfk_4` FOREIGN KEY (`id_reparador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10667,21 +11251,6 @@ CREATE TABLE `rolekk` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary view structure for view `root` --- - -DROP TABLE IF EXISTS `root`; -/*!50001 DROP VIEW IF EXISTS `root`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `root` AS SELECT - 1 AS `DiadelaSemana`, - 1 AS `Hora`, - 1 AS `Fecha`, - 1 AS `Dispositivo`*/; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `rounding` -- @@ -10745,7 +11314,7 @@ CREATE TABLE `salarioDits` ( `value_old` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `value_new` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idSalario_dits`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10762,7 +11331,29 @@ CREATE TABLE `scan` ( `name` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +) ENGINE=InnoDB AUTO_INCREMENT=44311 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `scanTree` +-- + +DROP TABLE IF EXISTS `scanTree`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `scanTree` ( + `id` int(11) NOT NULL DEFAULT '0', + `name` longtext CHARACTER SET utf8, + `lft` int(11) NOT NULL, + `rgt` int(11) NOT NULL, + `depth` bigint(22) NOT NULL DEFAULT '0', + `sons` decimal(10,0) DEFAULT NULL, + `lastScanned` datetime DEFAULT NULL, + `routeCount` int(11) DEFAULT NULL, + `minRoute` int(11) DEFAULT NULL, + `maxRoute` int(11) DEFAULT NULL, + `scanned` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10780,7 +11371,7 @@ CREATE TABLE `scan_line` ( PRIMARY KEY (`scan_line_id`), KEY `id_scan_id_idx` (`scan_id`), CONSTRAINT `id_scan_id` FOREIGN KEY (`scan_id`) REFERENCES `scan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=583328 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10802,7 +11393,7 @@ CREATE TABLE `sharingcart` ( KEY `Suplent` (`Id_Suplente`), CONSTRAINT `Suplent_key` FOREIGN KEY (`Id_Suplente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1691 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10880,7 +11471,7 @@ CREATE TABLE `sharingclient` ( KEY `Client` (`Id_Cliente`), CONSTRAINT `Clients_key` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10926,61 +11517,25 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Table structure for table `sms` +-- Temporary table structure for view `sms` -- DROP TABLE IF EXISTS `sms`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sms` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `Id_trabajador` int(11) NOT NULL, - `text` varchar(160) COLLATE utf8_unicode_ci NOT NULL, - `to` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `DATE_ODBC` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `sent` tinyint(4) NOT NULL DEFAULT '0', - `Id_Cliente` int(11) DEFAULT NULL, - `response` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `from` varchar(9) COLLATE utf8_unicode_ci NOT NULL DEFAULT '693474205', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `sms_bi` BEFORE INSERT ON `sms` - FOR EACH ROW - BEGIN - DECLARE intLast INT; - DECLARE strTrab VARCHAR(3); - - SET NEW.`to` = LTRIM(NEW.`to`); - IF NEW.`to` LIKE '6________' or NEW.`to` LIKE '7________'THEN - SET NEW.`to` = CONCAT('0034',REPLACE(NEW.`to`,' ','')); - ELSE - IF NEW.`to` NOT LIKE '00346________' or NEW.`to` NOT LIKE '00347________'THEN - INSERT INTO Mensajes(Mensaje,Fecha,Remitente,Destinatario) - VALUES(CONCAT("El mensaje que ha enviado no contenía un número de teléfono MÓVIL válido:",NEW.`to`),NOW(),20,NEW.Id_trabajador); - SELECT LAST_INSERT_ID() INTO intlast; - SELECT CodigoTrabajador INTO strTrab FROM Trabajadores WHERE id_Trabajador = NEW.Id_Trabajador; - INSERT INTO Incidencias(Incidencia,Id_Trabajador,Destino,Fecha,Fecha_Mod) - VALUES (CONCAT('@@ ' , intLast), 20,strTrab, NOW(),NOW()); - SET NEW.id = 0; -SET intLast = 'fallo provocado'; - END IF; - 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 */ ; +/*!50001 DROP VIEW IF EXISTS `sms`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `sms` ( + `id` tinyint NOT NULL, + `Id_trabajador` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `from` tinyint NOT NULL, + `to` tinyint NOT NULL, + `text` tinyint NOT NULL, + `sent` tinyint NOT NULL, + `response` tinyint NOT NULL, + `DATE_ODBC` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `split` @@ -11012,53 +11567,58 @@ CREATE TABLE `state` ( `code` varchar(45) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tag` +-- Temporary table structure for view `tag` -- DROP TABLE IF EXISTS `tag`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tag` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(25) CHARACTER SET utf8 NOT NULL, - `free` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `tag`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `tag` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `free` tinyint NOT NULL, + `isQuantitatif` tinyint NOT NULL, + `sourceTable` tinyint NOT NULL, + `unit` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `tarifa_componentes` +-- Temporary table structure for view `tarifa_componentes` -- DROP TABLE IF EXISTS `tarifa_componentes`; /*!50001 DROP VIEW IF EXISTS `tarifa_componentes`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `tarifa_componentes` AS SELECT - 1 AS `Id_Componente`, - 1 AS `Componente`, - 1 AS `tarifa_componentes_series_id`, - 1 AS `tarifa_class`, - 1 AS `tax`, - 1 AS `is_renewable`*/; +/*!50001 CREATE TABLE `tarifa_componentes` ( + `Id_Componente` tinyint NOT NULL, + `Componente` tinyint NOT NULL, + `tarifa_componentes_series_id` tinyint NOT NULL, + `tarifa_class` tinyint NOT NULL, + `tax` tinyint NOT NULL, + `is_renewable` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `tarifa_componentes_series` +-- Temporary table structure for view `tarifa_componentes_series` -- DROP TABLE IF EXISTS `tarifa_componentes_series`; /*!50001 DROP VIEW IF EXISTS `tarifa_componentes_series`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `tarifa_componentes_series` AS SELECT - 1 AS `tarifa_componentes_series_id`, - 1 AS `Serie`, - 1 AS `base`*/; +/*!50001 CREATE TABLE `tarifa_componentes_series` ( + `tarifa_componentes_series_id` tinyint NOT NULL, + `Serie` tinyint NOT NULL, + `base` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -11079,7 +11639,7 @@ CREATE TABLE `tarifas` ( PRIMARY KEY (`tarifa_id`), KEY `tarifa_warehouse` (`warehouse_id`), CONSTRAINT `tarifa_warehouse` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11245,18 +11805,19 @@ CREATE TABLE `thermograph` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticketCreationData` +-- Temporary table structure for view `ticketCreationData` -- DROP TABLE IF EXISTS `ticketCreationData`; /*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketCreationData` AS SELECT - 1 AS `DiadelaSemana`, - 1 AS `Hora`, - 1 AS `Fecha`, - 1 AS `Dispositivo`*/; +/*!50001 CREATE TABLE `ticketCreationData` ( + `DiadelaSemana` tinyint NOT NULL, + `Hora` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `Dispositivo` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -11292,68 +11853,9 @@ CREATE TABLE `ticket_observation` ( KEY `observation_type_id` (`observation_type_id`), CONSTRAINT `ticket_observation_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticket_observation_ibfk_2` FOREIGN KEY (`observation_type_id`) REFERENCES `observation_type` (`observation_type_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=978144 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `ticket_stateKK` --- - -DROP TABLE IF EXISTS `ticket_stateKK`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticket_stateKK` ( - `ticket_id` int(11) NOT NULL, - `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `user_id` int(11) NOT NULL, - `state_id` tinyint(1) unsigned NOT NULL DEFAULT '1', - UNIQUE KEY `ticket_id` (`ticket_id`), - KEY `user_id` (`user_id`), - KEY `state_id` (`state_id`), - CONSTRAINT `ticket_stateKK_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticket_stateKK_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `ticket_stateKK_ibfk_3` FOREIGN KEY (`state_id`) REFERENCES `state` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`ticket_stateAfterInsert` - AFTER INSERT ON `ticket_stateKK` FOR EACH ROW -BEGIN - CALL stock.queueAdd ('ticket', NEW.ticket_id, 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_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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`ticket_stateAfterDelete` - AFTER UPDATE ON `ticket_stateKK` FOR EACH ROW -BEGIN - CALL stock.queueAdd ('ticket', NEW.ticket_id, OLD.ticket_id); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - -- -- Table structure for table `tickets_gestdoc` -- @@ -11383,12 +11885,14 @@ CREATE TABLE `time` ( `year` int(4) NOT NULL, `day` int(2) NOT NULL, `week` int(2) NOT NULL, + `yearMonth` int(6) NOT NULL, PRIMARY KEY (`date`), KEY `day_index` (`day`) USING HASH, KEY `week_index` (`week`) USING HASH, KEY `year_index` (`year`) USING HASH, KEY `month_index` (`month`) USING HASH, - KEY `periodo` (`period`) USING HASH + KEY `periodo` (`period`) USING HASH, + KEY `yearMonth` (`yearMonth`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla de referencia para las semanas, años y meses'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -11459,6 +11963,7 @@ CREATE TABLE `travel` ( `received` tinyint(1) NOT NULL DEFAULT '0', `m3` decimal(10,2) unsigned DEFAULT NULL, `kg` decimal(10,0) unsigned DEFAULT NULL, + `cargoSupplierFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `shipment_2` (`shipment`,`landing`,`warehouse_id`,`warehouse_id_out`,`agency_id`,`ref`), KEY `agency_id` (`agency_id`), @@ -11466,10 +11971,12 @@ CREATE TABLE `travel` ( KEY `landing` (`landing`), KEY `warehouse_landing` (`warehouse_id`,`landing`), KEY `warehouse_out_shipment` (`warehouse_id_out`,`shipment`), + KEY `travel_ibfk_4_idx` (`cargoSupplierFk`), CONSTRAINT `travel_ibfk_1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouse_id_out`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; + CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, + CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `Proveedores` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=98906 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11532,7 +12039,7 @@ BEGIN SELECT Id_Trabajador into trabajador from Trabajadores where user_id = account.userGetId(); INSERT INTO travel_dits (idaccion_dits,Id_Trabajador,Id_Ticket,value_old,value_new) - VALUES (89/*Cambia delivered*/ ,IFNULL(trabajador,20),NEW.id,OLD.delivered,CONCAT(NEW.delivered,' desde ' ,user())); + VALUES (89/*Cambia delivered*/,IFNULL(trabajador,20),NEW.id,OLD.delivered,CONCAT(NEW.delivered,' desde ' ,user())); END IF; END */;; DELIMITER ; @@ -11553,6 +12060,13 @@ DELIMITER ;; AFTER UPDATE ON `travel` FOR EACH ROW BEGIN CALL stock.queueAdd ('travel', NEW.id, OLD.id); + + IF NEW.shipment != OLD.shipment THEN + + UPDATE Entradas + SET comision = getComision(Id_Entrada, Id_Moneda) + WHERE travel_id = NEW.id; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -11599,7 +12113,7 @@ CREATE TABLE `travel_dits` ( KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`), CONSTRAINT `travel_dits_ibfk_1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=148480 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11626,7 +12140,7 @@ CREATE TABLE `travel_pattern` ( CONSTRAINT `travel_pattern_ibfk_3` FOREIGN KEY (`warehouse_out`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_pattern_ibfk_4` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `travel_pattern_ibfk_5` FOREIGN KEY (`warehouse_in`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=318 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11692,7 +12206,7 @@ CREATE TABLE `trolley` ( `fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `ref` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=132 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11723,7 +12237,7 @@ CREATE TABLE `unary` ( UNIQUE KEY `idunary_UNIQUE` (`id`), KEY `unary_parent_idx` (`parent`), CONSTRAINT `unary_parent` FOREIGN KEY (`parent`) REFERENCES `unary` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=883 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11738,7 +12252,7 @@ CREATE TABLE `unaryScanFilter` ( `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `filter` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11775,7 +12289,7 @@ CREATE TABLE `unary_scan_line` ( UNIQUE KEY `id_UNIQUE` (`id`), KEY `unary_line_idx` (`unary_id`), CONSTRAINT `unary_line` FOREIGN KEY (`unary_id`) REFERENCES `unary_scan` (`unary_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8462 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11827,855 +12341,901 @@ CREATE TABLE `unary_source` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `v_Agenda` +-- Temporary table structure for view `v_Agenda` -- DROP TABLE IF EXISTS `v_Agenda`; /*!50001 DROP VIEW IF EXISTS `v_Agenda`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_Agenda` AS SELECT - 1 AS `Tipo`, - 1 AS `Id`, - 1 AS `Nombre`, - 1 AS `Telephone`*/; +/*!50001 CREATE TABLE `v_Agenda` ( + `Tipo` tinyint NOT NULL, + `Id` tinyint NOT NULL, + `Nombre` tinyint NOT NULL, + `Telephone` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_Agenda2` +-- Temporary table structure for view `v_Agenda2` -- DROP TABLE IF EXISTS `v_Agenda2`; /*!50001 DROP VIEW IF EXISTS `v_Agenda2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_Agenda2` AS SELECT - 1 AS `Tipo`, - 1 AS `Id`, - 1 AS `Nombre`, - 1 AS `Telefono`*/; +/*!50001 CREATE TABLE `v_Agenda2` ( + `Tipo` tinyint NOT NULL, + `Id` tinyint NOT NULL, + `Nombre` tinyint NOT NULL, + `Telefono` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_Articles_botanical` +-- Temporary table structure for view `v_Articles_botanical` -- DROP TABLE IF EXISTS `v_Articles_botanical`; /*!50001 DROP VIEW IF EXISTS `v_Articles_botanical`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_Articles_botanical` AS SELECT - 1 AS `Id_Article`, - 1 AS `edi_botanic`*/; +/*!50001 CREATE TABLE `v_Articles_botanical` ( + `Id_Article` tinyint NOT NULL, + `edi_botanic` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_Movimientos_Volumen_shipping_charge` +-- Temporary table structure for view `v_Movimientos_Volumen_shipping_charge` -- DROP TABLE IF EXISTS `v_Movimientos_Volumen_shipping_charge`; /*!50001 DROP VIEW IF EXISTS `v_Movimientos_Volumen_shipping_charge`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_Movimientos_Volumen_shipping_charge` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `Id_Movimiento`, - 1 AS `Fecha`, - 1 AS `price`, - 1 AS `freight`*/; +/*!50001 CREATE TABLE `v_Movimientos_Volumen_shipping_charge` ( + `Id_Ticket` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `price` tinyint NOT NULL, + `freight` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_Ordenes` +-- Temporary table structure for view `v_Ordenes` -- DROP TABLE IF EXISTS `v_Ordenes`; /*!50001 DROP VIEW IF EXISTS `v_Ordenes`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_Ordenes` AS SELECT - 1 AS `Id_ORDEN`, - 1 AS `ORDEN`, - 1 AS `datORDEN`, - 1 AS `datTICKET`, - 1 AS `CodVENDEDOR`, - 1 AS `CodCOMPRADOR`, - 1 AS `CANTIDAD`, - 1 AS `PRECIOMAX`, - 1 AS `PREU`, - 1 AS `Id_ARTICLE`, - 1 AS `Id_CLIENTE`, - 1 AS `COMENTARIO`, - 1 AS `OK`, - 1 AS `TOTAL`, - 1 AS `datCOMPRA`, - 1 AS `KO`, - 1 AS `Id_Movimiento`, - 1 AS `odbc_date`*/; +/*!50001 CREATE TABLE `v_Ordenes` ( + `Id_ORDEN` tinyint NOT NULL, + `ORDEN` tinyint NOT NULL, + `datORDEN` tinyint NOT NULL, + `datTICKET` tinyint NOT NULL, + `CodVENDEDOR` tinyint NOT NULL, + `CodCOMPRADOR` tinyint NOT NULL, + `CANTIDAD` tinyint NOT NULL, + `PRECIOMAX` tinyint NOT NULL, + `PREU` tinyint NOT NULL, + `Id_ARTICLE` tinyint NOT NULL, + `Id_CLIENTE` tinyint NOT NULL, + `COMENTARIO` tinyint NOT NULL, + `OK` tinyint NOT NULL, + `TOTAL` tinyint NOT NULL, + `datCOMPRA` tinyint NOT NULL, + `KO` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL, + `odbc_date` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_XDiario_ALL` +-- Temporary table structure for view `v_XDiario_ALL` -- DROP TABLE IF EXISTS `v_XDiario_ALL`; /*!50001 DROP VIEW IF EXISTS `v_XDiario_ALL`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_XDiario_ALL` AS SELECT - 1 AS `empresa_id`, - 1 AS `SUBCTA`, - 1 AS `Eurodebe`, - 1 AS `Eurohaber`, - 1 AS `Fecha`, - 1 AS `FECHA_EX`*/; +/*!50001 CREATE TABLE `v_XDiario_ALL` ( + `empresa_id` tinyint NOT NULL, + `SUBCTA` tinyint NOT NULL, + `Eurodebe` tinyint NOT NULL, + `Eurohaber` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `FECHA_EX` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_accion` +-- Temporary table structure for view `v_accion` -- DROP TABLE IF EXISTS `v_accion`; /*!50001 DROP VIEW IF EXISTS `v_accion`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_accion` AS SELECT - 1 AS `accion_id`, - 1 AS `accion`*/; +/*!50001 CREATE TABLE `v_accion` ( + `accion_id` tinyint NOT NULL, + `accion` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_account` +-- Temporary table structure for view `v_account` -- DROP TABLE IF EXISTS `v_account`; /*!50001 DROP VIEW IF EXISTS `v_account`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_account` AS SELECT - 1 AS `user_id`*/; +/*!50001 CREATE TABLE `v_account` ( + `user_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_analisis_ventas` +-- Temporary table structure for view `v_analisis_ventas` -- DROP TABLE IF EXISTS `v_analisis_ventas`; /*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_analisis_ventas` AS SELECT - 1 AS `Familia`, - 1 AS `Reino`, - 1 AS `Comercial`, - 1 AS `Comprador`, - 1 AS `Provincia`, - 1 AS `almacen`, - 1 AS `Año`, - 1 AS `Mes`, - 1 AS `Semana`, - 1 AS `Vista`, - 1 AS `Importe`*/; +/*!50001 CREATE TABLE `v_analisis_ventas` ( + `Familia` tinyint NOT NULL, + `Reino` tinyint NOT NULL, + `Comercial` tinyint NOT NULL, + `Comprador` tinyint NOT NULL, + `Provincia` tinyint NOT NULL, + `almacen` tinyint NOT NULL, + `Año` tinyint NOT NULL, + `Mes` tinyint NOT NULL, + `Semana` tinyint NOT NULL, + `Vista` tinyint NOT NULL, + `Importe` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_awb_volumen` +-- Temporary table structure for view `v_awb_volumen` -- DROP TABLE IF EXISTS `v_awb_volumen`; /*!50001 DROP VIEW IF EXISTS `v_awb_volumen`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_awb_volumen` AS SELECT - 1 AS `awb_id`, - 1 AS `codigo`, - 1 AS `importe`, - 1 AS `Vol_Total`*/; +/*!50001 CREATE TABLE `v_awb_volumen` ( + `awb_id` tinyint NOT NULL, + `codigo` tinyint NOT NULL, + `importe` tinyint NOT NULL, + `Vol_Total` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_barcodes` +-- Temporary table structure for view `v_barcodes` -- DROP TABLE IF EXISTS `v_barcodes`; /*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_barcodes` AS SELECT - 1 AS `code`, - 1 AS `Id_Article`*/; +/*!50001 CREATE TABLE `v_barcodes` ( + `code` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_barcodes_plus` +-- Temporary table structure for view `v_barcodes_plus` -- DROP TABLE IF EXISTS `v_barcodes_plus`; /*!50001 DROP VIEW IF EXISTS `v_barcodes_plus`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_barcodes_plus` AS SELECT - 1 AS `code`, - 1 AS `Id_Article`, - 1 AS `Article`, - 1 AS `Medida`, - 1 AS `Color`, - 1 AS `Categoria`, - 1 AS `Producer`*/; +/*!50001 CREATE TABLE `v_barcodes_plus` ( + `code` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `Article` tinyint NOT NULL, + `Medida` tinyint NOT NULL, + `Color` tinyint NOT NULL, + `Categoria` tinyint NOT NULL, + `Producer` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_botanic_export` +-- Temporary table structure for view `v_botanic_export` -- DROP TABLE IF EXISTS `v_botanic_export`; /*!50001 DROP VIEW IF EXISTS `v_botanic_export`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_botanic_export` AS SELECT - 1 AS `Nom_botanic`, - 1 AS `Id_Paises`, - 1 AS `restriction`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `v_botanic_export` ( + `Nom_botanic` tinyint NOT NULL, + `Id_Paises` tinyint NOT NULL, + `restriction` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_compres` +-- Temporary table structure for view `v_compres` -- DROP TABLE IF EXISTS `v_compres`; /*!50001 DROP VIEW IF EXISTS `v_compres`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_compres` AS SELECT - 1 AS `Familia`, - 1 AS `reino_id`, - 1 AS `Id_Compra`, - 1 AS `Id_Entrada`, - 1 AS `Id_Article`, - 1 AS `Cantidad`, - 1 AS `Costefijo`, - 1 AS `Portefijo`, - 1 AS `Novincular`, - 1 AS `Etiquetas`, - 1 AS `Packing`, - 1 AS `grouping`, - 1 AS `Comisionfija`, - 1 AS `Embalajefijo`, - 1 AS `Nicho`, - 1 AS `Id_Cubo`, - 1 AS `Tarifa1`, - 1 AS `Tarifa2`, - 1 AS `Tarifa3`, - 1 AS `PVP`, - 1 AS `Vida`, - 1 AS `Id_Trabajador`, - 1 AS `punteo`, - 1 AS `odbc_date`, - 1 AS `Inventario`, - 1 AS `Id_Proveedor`, - 1 AS `Fecha`, - 1 AS `Confirmada`, - 1 AS `Redada`, - 1 AS `empresa_id`, - 1 AS `travel_id`, - 1 AS `Pedida`, - 1 AS `recibida_id`, - 1 AS `id`, - 1 AS `shipment`, - 1 AS `landing`, - 1 AS `warehouse_id`, - 1 AS `warehouse_id_out`, - 1 AS `agency_id`, - 1 AS `ref`, - 1 AS `delivered`, - 1 AS `received`, - 1 AS `Article`, - 1 AS `Medida`, - 1 AS `Tallos`, - 1 AS `caja`, - 1 AS `Categoria`, - 1 AS `id_origen`, - 1 AS `Tipo`, - 1 AS `tipo_id`, - 1 AS `Color`, - 1 AS `Min`, - 1 AS `Coste`, - 1 AS `fuente`, - 1 AS `iva_group_id`, - 1 AS `cm3`, - 1 AS `producer_id`*/; +/*!50001 CREATE TABLE `v_compres` ( + `Familia` tinyint NOT NULL, + `reino_id` tinyint NOT NULL, + `Id_Compra` tinyint NOT NULL, + `Id_Entrada` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `Cantidad` tinyint NOT NULL, + `Costefijo` tinyint NOT NULL, + `Portefijo` tinyint NOT NULL, + `Novincular` tinyint NOT NULL, + `Etiquetas` tinyint NOT NULL, + `Packing` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `Comisionfija` tinyint NOT NULL, + `Embalajefijo` tinyint NOT NULL, + `Nicho` tinyint NOT NULL, + `Id_Cubo` tinyint NOT NULL, + `Tarifa1` tinyint NOT NULL, + `Tarifa2` tinyint NOT NULL, + `Tarifa3` tinyint NOT NULL, + `PVP` tinyint NOT NULL, + `Vida` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL, + `punteo` tinyint NOT NULL, + `odbc_date` tinyint NOT NULL, + `Inventario` tinyint NOT NULL, + `Id_Proveedor` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `Confirmada` tinyint NOT NULL, + `Redada` tinyint NOT NULL, + `empresa_id` tinyint NOT NULL, + `travel_id` tinyint NOT NULL, + `Pedida` tinyint NOT NULL, + `recibida_id` tinyint NOT NULL, + `id` tinyint NOT NULL, + `shipment` tinyint NOT NULL, + `landing` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `warehouse_id_out` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `delivered` tinyint NOT NULL, + `received` tinyint NOT NULL, + `Article` tinyint NOT NULL, + `Medida` tinyint NOT NULL, + `Tallos` tinyint NOT NULL, + `caja` tinyint NOT NULL, + `Categoria` tinyint NOT NULL, + `id_origen` tinyint NOT NULL, + `Tipo` tinyint NOT NULL, + `tipo_id` tinyint NOT NULL, + `Color` tinyint NOT NULL, + `Min` tinyint NOT NULL, + `Coste` tinyint NOT NULL, + `fuente` tinyint NOT NULL, + `iva_group_id` tinyint NOT NULL, + `cm3` tinyint NOT NULL, + `producer_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_departure_limit` +-- Temporary table structure for view `v_departure_limit` -- DROP TABLE IF EXISTS `v_departure_limit`; /*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_departure_limit` AS SELECT - 1 AS `warehouse_id`, - 1 AS `fecha`, - 1 AS `hora`, - 1 AS `minSpeed`*/; +/*!50001 CREATE TABLE `v_departure_limit` ( + `warehouse_id` tinyint NOT NULL, + `fecha` tinyint NOT NULL, + `hora` tinyint NOT NULL, + `minSpeed` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_descuadre_bionic` +-- Temporary table structure for view `v_descuadre_bionic` -- DROP TABLE IF EXISTS `v_descuadre_bionic`; /*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_descuadre_bionic` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `Alias`, - 1 AS `Concepte`, - 1 AS `suma_componente`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `diferencia`, - 1 AS `Fecha`, - 1 AS `benvenut`*/; +/*!50001 CREATE TABLE `v_descuadre_bionic` ( + `Id_Ticket` tinyint NOT NULL, + `Alias` tinyint NOT NULL, + `Concepte` tinyint NOT NULL, + `suma_componente` tinyint NOT NULL, + `Preu` tinyint NOT NULL, + `Descuento` tinyint NOT NULL, + `diferencia` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `benvenut` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_descuadre_porte` +-- Temporary table structure for view `v_descuadre_porte` -- DROP TABLE IF EXISTS `v_descuadre_porte`; /*!50001 DROP VIEW IF EXISTS `v_descuadre_porte`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_descuadre_porte` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `suma_componente`, - 1 AS `teorico_agencia`, - 1 AS `diferencia`, - 1 AS `Fecha`*/; +/*!50001 CREATE TABLE `v_descuadre_porte` ( + `Id_Ticket` tinyint NOT NULL, + `suma_componente` tinyint NOT NULL, + `teorico_agencia` tinyint NOT NULL, + `diferencia` tinyint NOT NULL, + `Fecha` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_descuadre_porte2` +-- Temporary table structure for view `v_descuadre_porte2` -- DROP TABLE IF EXISTS `v_descuadre_porte2`; /*!50001 DROP VIEW IF EXISTS `v_descuadre_porte2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_descuadre_porte2` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `suma_componente`, - 1 AS `Fecha`*/; +/*!50001 CREATE TABLE `v_descuadre_porte2` ( + `Id_Ticket` tinyint NOT NULL, + `suma_componente` tinyint NOT NULL, + `Fecha` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_empresa` +-- Temporary table structure for view `v_empresa` -- DROP TABLE IF EXISTS `v_empresa`; /*!50001 DROP VIEW IF EXISTS `v_empresa`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_empresa` AS SELECT - 1 AS `logo`, - 1 AS `id`, - 1 AS `registro`, - 1 AS `gerente_id`, - 1 AS `alta`, - 1 AS `Nombre`, - 1 AS `Apellidos`, - 1 AS `Proveedor`, - 1 AS `Domicilio`, - 1 AS `CP`, - 1 AS `Localidad`, - 1 AS `NIF`, - 1 AS `Telefono`, - 1 AS `Alias`, - 1 AS `abbreviation`*/; +/*!50001 CREATE TABLE `v_empresa` ( + `logo` tinyint NOT NULL, + `id` tinyint NOT NULL, + `registro` tinyint NOT NULL, + `gerente_id` tinyint NOT NULL, + `alta` tinyint NOT NULL, + `Nombre` tinyint NOT NULL, + `Apellidos` tinyint NOT NULL, + `Proveedor` tinyint NOT NULL, + `Domicilio` tinyint NOT NULL, + `CP` tinyint NOT NULL, + `Localidad` tinyint NOT NULL, + `NIF` tinyint NOT NULL, + `Telefono` tinyint NOT NULL, + `Alias` tinyint NOT NULL, + `abbreviation` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_encajado` +-- Temporary table structure for view `v_encajado` -- DROP TABLE IF EXISTS `v_encajado`; /*!50001 DROP VIEW IF EXISTS `v_encajado`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_encajado` AS SELECT - 1 AS `hora`, - 1 AS `minuto`, - 1 AS `cm3`, - 1 AS `warehouse_id`*/; +/*!50001 CREATE TABLE `v_encajado` ( + `hora` tinyint NOT NULL, + `minuto` tinyint NOT NULL, + `cm3` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_encajado_ultima_hora` +-- Temporary table structure for view `v_encajado_ultima_hora` -- DROP TABLE IF EXISTS `v_encajado_ultima_hora`; /*!50001 DROP VIEW IF EXISTS `v_encajado_ultima_hora`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_encajado_ultima_hora` AS SELECT - 1 AS `m3`, - 1 AS `warehouse_id`*/; +/*!50001 CREATE TABLE `v_encajado_ultima_hora` ( + `m3` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_expeditions_shipping_charge` +-- Temporary table structure for view `v_expeditions_shipping_charge` -- DROP TABLE IF EXISTS `v_expeditions_shipping_charge`; /*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_charge`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_expeditions_shipping_charge` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `shipping_charge`, - 1 AS `Fecha`*/; +/*!50001 CREATE TABLE `v_expeditions_shipping_charge` ( + `Id_Ticket` tinyint NOT NULL, + `shipping_charge` tinyint NOT NULL, + `Fecha` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_expeditions_shipping_charge2` +-- Temporary table structure for view `v_expeditions_shipping_charge2` -- DROP TABLE IF EXISTS `v_expeditions_shipping_charge2`; /*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_charge2`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_expeditions_shipping_charge2` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `shipping_charge`, - 1 AS `Fecha`, - 1 AS `warehouse_id`*/; +/*!50001 CREATE TABLE `v_expeditions_shipping_charge2` ( + `Id_Ticket` tinyint NOT NULL, + `shipping_charge` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_fallo` +-- Temporary table structure for view `v_fallo` -- DROP TABLE IF EXISTS `v_fallo`; /*!50001 DROP VIEW IF EXISTS `v_fallo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_fallo` AS SELECT - 1 AS `queja_id`, - 1 AS `accion_id`*/; +/*!50001 CREATE TABLE `v_fallo` ( + `queja_id` tinyint NOT NULL, + `accion_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_inter` +-- Temporary table structure for view `v_inter` -- DROP TABLE IF EXISTS `v_inter`; /*!50001 DROP VIEW IF EXISTS `v_inter`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_inter` AS SELECT - 1 AS `inter_id`, - 1 AS `state_id`, - 1 AS `nota`, - 1 AS `odbc_date`, - 1 AS `Id_Ticket`, - 1 AS `Id_Trabajador`, - 1 AS `Id_supervisor`*/; +/*!50001 CREATE TABLE `v_inter` ( + `inter_id` tinyint NOT NULL, + `state_id` tinyint NOT NULL, + `nota` tinyint NOT NULL, + `odbc_date` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL, + `Id_supervisor` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_jerarquia` +-- Temporary table structure for view `v_jerarquia` -- DROP TABLE IF EXISTS `v_jerarquia`; /*!50001 DROP VIEW IF EXISTS `v_jerarquia`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_jerarquia` AS SELECT - 1 AS `Id_Trabajador`, - 1 AS `boss_id`*/; +/*!50001 CREATE TABLE `v_jerarquia` ( + `Id_Trabajador` tinyint NOT NULL, + `boss_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_location` +-- Temporary table structure for view `v_location` -- DROP TABLE IF EXISTS `v_location`; /*!50001 DROP VIEW IF EXISTS `v_location`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_location` AS SELECT - 1 AS `longitude`, - 1 AS `latitude`, - 1 AS `Id_Consigna`*/; +/*!50001 CREATE TABLE `v_location` ( + `longitude` tinyint NOT NULL, + `latitude` tinyint NOT NULL, + `Id_Consigna` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_mana_spellers` +-- Temporary table structure for view `v_mana_spellers` -- DROP TABLE IF EXISTS `v_mana_spellers`; /*!50001 DROP VIEW IF EXISTS `v_mana_spellers`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_mana_spellers` AS SELECT - 1 AS `Id_Trabajador`, - 1 AS `size`, - 1 AS `used`*/; +/*!50001 CREATE TABLE `v_mana_spellers` ( + `Id_Trabajador` tinyint NOT NULL, + `size` tinyint NOT NULL, + `used` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_miriam` +-- Temporary table structure for view `v_miriam` -- DROP TABLE IF EXISTS `v_miriam`; /*!50001 DROP VIEW IF EXISTS `v_miriam`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_miriam` AS SELECT - 1 AS `Id_Article`, - 1 AS `Concepte`, - 1 AS `Cantidad`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `Fecha`, - 1 AS `Id_Cliente`, - 1 AS `Importe`*/; +/*!50001 CREATE TABLE `v_miriam` ( + `Id_Article` tinyint NOT NULL, + `Concepte` tinyint NOT NULL, + `Cantidad` tinyint NOT NULL, + `Preu` tinyint NOT NULL, + `Descuento` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `Importe` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_movimientos_log` +-- Temporary table structure for view `v_movimientos_log` -- DROP TABLE IF EXISTS `v_movimientos_log`; /*!50001 DROP VIEW IF EXISTS `v_movimientos_log`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_movimientos_log` AS SELECT - 1 AS `idmovimientos_log`, - 1 AS `Id_Movimiento`, - 1 AS `odbc_date`, - 1 AS `Id_Trabajador`, - 1 AS `field_name`, - 1 AS `new_value`*/; +/*!50001 CREATE TABLE `v_movimientos_log` ( + `idmovimientos_log` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL, + `odbc_date` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL, + `field_name` tinyint NOT NULL, + `new_value` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_movimientos_mark` +-- Temporary table structure for view `v_movimientos_mark` -- DROP TABLE IF EXISTS `v_movimientos_mark`; /*!50001 DROP VIEW IF EXISTS `v_movimientos_mark`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_movimientos_mark` AS SELECT - 1 AS `Id_Movimiento`, - 1 AS `Accion`*/; +/*!50001 CREATE TABLE `v_movimientos_mark` ( + `Id_Movimiento` tinyint NOT NULL, + `Accion` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_pedidos_auto_preparados` +-- Temporary table structure for view `v_pedidos_auto_preparados` -- DROP TABLE IF EXISTS `v_pedidos_auto_preparados`; /*!50001 DROP VIEW IF EXISTS `v_pedidos_auto_preparados`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_pedidos_auto_preparados` AS SELECT - 1 AS `CodigoTrabajador`, - 1 AS `Id_Ticket`, - 1 AS `Momento`*/; +/*!50001 CREATE TABLE `v_pedidos_auto_preparados` ( + `CodigoTrabajador` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Momento` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_pedidos_auto_preparadoskk` +-- Temporary table structure for view `v_pedidos_auto_preparadoskk` -- DROP TABLE IF EXISTS `v_pedidos_auto_preparadoskk`; /*!50001 DROP VIEW IF EXISTS `v_pedidos_auto_preparadoskk`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_pedidos_auto_preparadoskk` AS SELECT - 1 AS `CodigoTrabajador`, - 1 AS `Fecha`, - 1 AS `Id_Ticket`, - 1 AS `Momento`*/; +/*!50001 CREATE TABLE `v_pedidos_auto_preparadoskk` ( + `CodigoTrabajador` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Momento` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_phonebook` +-- Temporary table structure for view `v_phonebook` -- DROP TABLE IF EXISTS `v_phonebook`; /*!50001 DROP VIEW IF EXISTS `v_phonebook`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_phonebook` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `Telefono`*/; +/*!50001 CREATE TABLE `v_phonebook` ( + `Id_Cliente` tinyint NOT NULL, + `Telefono` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_price_fixed` +-- Temporary table structure for view `v_price_fixed` -- DROP TABLE IF EXISTS `v_price_fixed`; /*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_price_fixed` AS SELECT - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `rate_0`, - 1 AS `rate_1`, - 1 AS `rate_2`, - 1 AS `rate_3`, - 1 AS `date_start`, - 1 AS `date_end`, - 1 AS `bonus`, - 1 AS `grouping`, - 1 AS `Packing`, - 1 AS `caja`*/; +/*!50001 CREATE TABLE `v_price_fixed` ( + `warehouse_id` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `rate_0` tinyint NOT NULL, + `rate_1` tinyint NOT NULL, + `rate_2` tinyint NOT NULL, + `rate_3` tinyint NOT NULL, + `date_start` tinyint NOT NULL, + `date_end` tinyint NOT NULL, + `bonus` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `Packing` tinyint NOT NULL, + `caja` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_price_fixed_group` +-- Temporary table structure for view `v_price_fixed_group` -- DROP TABLE IF EXISTS `v_price_fixed_group`; /*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_price_fixed_group` AS SELECT - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `rate_0`, - 1 AS `rate_1`, - 1 AS `rate_2`, - 1 AS `rate_3`, - 1 AS `date_start`, - 1 AS `date_end`, - 1 AS `bonus`, - 1 AS `grouping`, - 1 AS `Packing`, - 1 AS `caja`*/; +/*!50001 CREATE TABLE `v_price_fixed_group` ( + `warehouse_id` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `rate_0` tinyint NOT NULL, + `rate_1` tinyint NOT NULL, + `rate_2` tinyint NOT NULL, + `rate_3` tinyint NOT NULL, + `date_start` tinyint NOT NULL, + `date_end` tinyint NOT NULL, + `bonus` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `Packing` tinyint NOT NULL, + `caja` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_session` +-- Temporary table structure for view `v_session` -- DROP TABLE IF EXISTS `v_session`; /*!50001 DROP VIEW IF EXISTS `v_session`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_session` AS SELECT - 1 AS `id`, - 1 AS `CodigoTrabajador`, - 1 AS `Id_Trabajador`, - 1 AS `Id_Cliente`, - 1 AS `Cliente`, - 1 AS `Fecha`*/; +/*!50001 CREATE TABLE `v_session` ( + `id` tinyint NOT NULL, + `CodigoTrabajador` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `Cliente` tinyint NOT NULL, + `Fecha` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_ticket_amount` +-- Temporary table structure for view `v_ticket_amount` -- DROP TABLE IF EXISTS `v_ticket_amount`; /*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ticket_amount` AS SELECT - 1 AS `Id_Ticket`, - 1 AS `amount`*/; +/*!50001 CREATE TABLE `v_ticket_amount` ( + `Id_Ticket` tinyint NOT NULL, + `amount` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_trabajadores` +-- Temporary table structure for view `v_trabajadores` -- DROP TABLE IF EXISTS `v_trabajadores`; /*!50001 DROP VIEW IF EXISTS `v_trabajadores`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_trabajadores` AS SELECT - 1 AS `CodigoTrabajador`, - 1 AS `Nombre`, - 1 AS `Fecha_Inicio`, - 1 AS `Password`, - 1 AS `user`, - 1 AS `Apellidos`, - 1 AS `Id_Trabajador`, - 1 AS `Foto`*/; +/*!50001 CREATE TABLE `v_trabajadores` ( + `CodigoTrabajador` tinyint NOT NULL, + `Nombre` tinyint NOT NULL, + `Fecha_Inicio` tinyint NOT NULL, + `Password` tinyint NOT NULL, + `user` tinyint NOT NULL, + `Apellidos` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL, + `Foto` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_user` +-- Temporary table structure for view `v_user` -- DROP TABLE IF EXISTS `v_user`; /*!50001 DROP VIEW IF EXISTS `v_user`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_user` AS SELECT - 1 AS `id`, - 1 AS `mysql_user_id`, - 1 AS `name`, - 1 AS `password`, - 1 AS `active`*/; +/*!50001 CREATE TABLE `v_user` ( + `id` tinyint NOT NULL, + `mysql_user_id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `password` tinyint NOT NULL, + `active` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_ventes` +-- 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`*/; +/*!50001 CREATE TABLE `v_ventes` ( + `Agencia` tinyint NOT NULL, + `Categoria` tinyint NOT NULL, + `tipo_id` tinyint NOT NULL, + `Medida` tinyint NOT NULL, + `Article` tinyint NOT NULL, + `Color` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `Tipo` tinyint NOT NULL, + `Factura` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `Familia` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Concepte` tinyint NOT NULL, + `Cantidad` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `Preu` tinyint NOT NULL, + `Descuento` tinyint NOT NULL, + `CostFixat` tinyint NOT NULL, + `Reservado` tinyint NOT NULL, + `OK` tinyint NOT NULL, + `PrecioFijado` tinyint NOT NULL, + `odbc_date` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `FechaCompleta` tinyint NOT NULL, + `Alias` tinyint NOT NULL, + `Id_Consigna` tinyint NOT NULL, + `Importe` tinyint NOT NULL, + `Origen` tinyint NOT NULL, + `reino_id` tinyint NOT NULL, + `invoice` tinyint NOT NULL, + `producer_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_venteskk` +-- Temporary table structure for view `v_venteskk` -- DROP TABLE IF EXISTS `v_venteskk`; /*!50001 DROP VIEW IF EXISTS `v_venteskk`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_venteskk` 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`*/; +/*!50001 CREATE TABLE `v_venteskk` ( + `Agencia` tinyint NOT NULL, + `Categoria` tinyint NOT NULL, + `tipo_id` tinyint NOT NULL, + `Medida` tinyint NOT NULL, + `Article` tinyint NOT NULL, + `Color` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `Tipo` tinyint NOT NULL, + `Factura` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `Familia` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Concepte` tinyint NOT NULL, + `Cantidad` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `Preu` tinyint NOT NULL, + `Descuento` tinyint NOT NULL, + `CostFixat` tinyint NOT NULL, + `Reservado` tinyint NOT NULL, + `OK` tinyint NOT NULL, + `PrecioFijado` tinyint NOT NULL, + `odbc_date` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `FechaCompleta` tinyint NOT NULL, + `Alias` tinyint NOT NULL, + `Id_Consigna` tinyint NOT NULL, + `Importe` tinyint NOT NULL, + `Origen` tinyint NOT NULL, + `reino_id` tinyint NOT NULL, + `invoice` tinyint NOT NULL, + `producer_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_warehouse` +-- Temporary table structure for view `v_warehouse` -- DROP TABLE IF EXISTS `v_warehouse`; /*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_warehouse` AS SELECT - 1 AS `id`, - 1 AS `almacen`*/; +/*!50001 CREATE TABLE `v_warehouse` ( + `id` tinyint NOT NULL, + `almacen` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_xsubclien` +-- Temporary table structure for view `v_xsubclien` -- DROP TABLE IF EXISTS `v_xsubclien`; /*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubclien` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `empresa_id`*/; +/*!50001 CREATE TABLE `v_xsubclien` ( + `Id_Cliente` tinyint NOT NULL, + `empresa_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_xsubcuentas` +-- 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`*/; +/*!50001 CREATE TABLE `v_xsubcuentas` ( + `COD` tinyint NOT NULL, + `TITULO` tinyint NOT NULL, + `NIF` tinyint NOT NULL, + `DOMICILIO` tinyint NOT NULL, + `POBLACION` tinyint NOT NULL, + `PROVINCIA` tinyint NOT NULL, + `CODPOSTAL` tinyint NOT NULL, + `country_code` tinyint NOT NULL, + `empresa_id` tinyint NOT NULL, + `EMAIL` tinyint NOT NULL, + `IDNIF` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `v_xsubprov` +-- Temporary table structure for view `v_xsubprov` -- DROP TABLE IF EXISTS `v_xsubprov`; /*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubprov` AS SELECT - 1 AS `proveedor_id`, - 1 AS `empresa_id`*/; +/*!50001 CREATE TABLE `v_xsubprov` ( + `proveedor_id` tinyint NOT NULL, + `empresa_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -12690,7 +13250,7 @@ CREATE TABLE `versiones` ( `version` int(11) NOT NULL, `critical` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`programa`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12711,49 +13271,52 @@ CREATE TABLE `viaxpress` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `vnCreditClassification` +-- Temporary table structure for view `vnCreditClassification` -- DROP TABLE IF EXISTS `vnCreditClassification`; /*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnCreditClassification` AS SELECT - 1 AS `id`, - 1 AS `client`, - 1 AS `dateStart`, - 1 AS `dateEnd`*/; +/*!50001 CREATE TABLE `vnCreditClassification` ( + `id` tinyint NOT NULL, + `client` tinyint NOT NULL, + `dateStart` tinyint NOT NULL, + `dateEnd` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `vnCreditInsurance` +-- Temporary table structure for view `vnCreditInsurance` -- DROP TABLE IF EXISTS `vnCreditInsurance`; /*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnCreditInsurance` AS SELECT - 1 AS `id`, - 1 AS `creditClassification`, - 1 AS `credit`, - 1 AS `creationDate`, - 1 AS `grade`*/; +/*!50001 CREATE TABLE `vnCreditInsurance` ( + `id` tinyint NOT NULL, + `creditClassification` tinyint NOT NULL, + `credit` tinyint NOT NULL, + `creationDate` tinyint NOT NULL, + `grade` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `vnSolunionCAP` +-- Temporary table structure for view `vnSolunionCAP` -- DROP TABLE IF EXISTS `vnSolunionCAP`; /*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `vnSolunionCAP` AS SELECT - 1 AS `creditInsurance`, - 1 AS `dateStart`, - 1 AS `dateEnd`, - 1 AS `dateLeaving`*/; +/*!50001 CREATE TABLE `vnSolunionCAP` ( + `creditInsurance` tinyint NOT NULL, + `dateStart` tinyint NOT NULL, + `dateEnd` tinyint NOT NULL, + `dateLeaving` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -12783,7 +13346,7 @@ CREATE TABLE `warehouse` ( UNIQUE KEY `name_UNIQUE` (`name`), KEY `Id_Paises` (`Id_Paises`), CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`Id_Paises`) REFERENCES `Paises` (`Id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12841,7 +13404,7 @@ CREATE TABLE `warehouse_alias` ( `warehouse_alias_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `alias` varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`warehouse_alias_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12988,7 +13551,7 @@ CREATE TABLE `wks` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `comments` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=626 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13007,17 +13570,18 @@ CREATE TABLE `workcenter_holiday` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerDocument` +-- 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`*/; +/*!50001 CREATE TABLE `workerDocument` ( + `id` tinyint NOT NULL, + `worker` tinyint NOT NULL, + `document` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -13034,35 +13598,37 @@ CREATE TABLE `workerTeam` ( PRIMARY KEY (`id`), KEY `user_team_idx` (`user`), CONSTRAINT `user_team` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerTeamCollegues` +-- Temporary table structure for view `workerTeamCollegues` -- DROP TABLE IF EXISTS `workerTeamCollegues`; /*!50001 DROP VIEW IF EXISTS `workerTeamCollegues`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerTeamCollegues` AS SELECT - 1 AS `workerId`, - 1 AS `collegueId`*/; +/*!50001 CREATE TABLE `workerTeamCollegues` ( + `workerId` tinyint NOT NULL, + `collegueId` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `workerTeam_kk` +-- Temporary table structure for view `workerTeam_kk` -- DROP TABLE IF EXISTS `workerTeam_kk`; /*!50001 DROP VIEW IF EXISTS `workerTeam_kk`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerTeam_kk` AS SELECT - 1 AS `team`, - 1 AS `user`, - 1 AS `id`, - 1 AS `Id_Trabajador`*/; +/*!50001 CREATE TABLE `workerTeam_kk` ( + `team` tinyint NOT NULL, + `user` tinyint NOT NULL, + `id` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -13079,6 +13645,22 @@ CREATE TABLE `zeleris` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `zoneNickname` +-- + +DROP TABLE IF EXISTS `zoneNickname`; +/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `zoneNickname` ( + `warehouse_id` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `zona` tinyint NOT NULL, + `alias` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `zones` -- @@ -13094,199 +13676,88 @@ CREATE TABLE `zones` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Zonas de reparto'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Dumping events for database 'vn2008' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `cierre automatico` */; +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 = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `cierre automatico` ON SCHEDULE EVERY 1 DAY STARTS '2016-05-25 23:00:00' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Realiza el cierre de todos los Warehouse' DO INSERT INTO `vn2008`.`Colas` (`Id_Informe`,`Cola`) VALUES ('2',CURDATE()) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +/*!50106 DROP EVENT IF EXISTS `closeTickets` */;; +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 = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `closeTickets` ON SCHEDULE EVERY 1 DAY STARTS '2017-06-23 07:20:00' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Vuelve a realizar el cierre del dia anterior por la mañana.' DO INSERT INTO `vn2008`.`Colas` (`Id_Informe`,`Cola`) VALUES ('2',DATE_ADD(CURDATE(), INTERVAL -1 DAY)) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +/*!50106 DROP EVENT IF EXISTS `item_cache_cleaner` */;; +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 = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `item_cache_cleaner` ON SCHEDULE EVERY 30 SECOND STARTS '2014-06-30 13:38:27' ON COMPLETION NOT PRESERVE DISABLE COMMENT 'Cleans the item cache' DO CALL item_cache_cleaner () */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +/*!50106 DROP EVENT IF EXISTS `raidUpdate` */;; +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 = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `raidUpdate` ON SCHEDULE EVERY 1 DAY STARTS '2017-12-29 00:05:00' ON COMPLETION PRESERVE ENABLE DO CALL raidUpdate */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + -- -- Dumping routines for database 'vn2008' -- -/*!50003 DROP FUNCTION IF EXISTS `AltaEmpleado` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `AltaEmpleado`(strCodTrabajador varchar(3),strNombre varchar(50),strApellidos varchar(50),strDni varchar(9), - strDomicilio longtext,strCodPostal varchar(5),strPoblacion varchar(25),provinceId smallint(5), intempresa_id smallint(5),strMovil varchar(11)) RETURNS varchar(50) CHARSET utf8 -BEGIN - -DECLARE RETORNO varchar(50) DEFAULT 'Empleado creado CORRECTAMENTE'; -DECLARE tmpUserId INT(11) DEFAULT 0; -DECLARE intId_Cliente int(11) DEFAULT 0; -DECLARE Cod_Trabajador VARCHAR(8) DEFAULT strCodTrabajador; -DECLARE strPassword VARCHAR(50); -DECLARE strSambaNombre VARCHAR(30); - -samba:BEGIN - -proc:BEGIN - -- IF (boolCrearSamba) THEN - -- SELECT Id_Cliente_Interno INTO intId_Cliente FROM Trabajadores WHERE Nombre=strNombre and Apellidos=strApellidos; - -- SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - -- LEAVE proc; - -- END IF; --- Tabla Clientes -SELECT COUNT(*) INTO intId_Cliente FROM Clientes WHERE `IF`=strDni; -IF (intId_Cliente=0) THEN - -- SELECT IFNULL(province_id,1) INTO intprovince_id FROM province WHERE `name`=strProvincia; - SELECT MAX(Id_Cliente)+1 INTO intId_Cliente FROM Clientes WHERE Id_Cliente<999999; - - INSERT INTO Clientes (Id_Cliente,Cliente,Domicilio,`IF`,Telefono,province_id,Poblacion,CodPostal,RazonSocial,Contacto,Oficial,Descuento) - SELECT intId_Cliente,Concat('TR ',strNombre,' ',StrApellidos),strDomicilio,strDni,strMovil,provinceId,strPoblacion,strCodPostal, - CONCAT(strApellidos,' ',strNombre),strNombre,1,3; -ELSE - SELECT id_cliente INTO intId_Cliente FROM Clientes WHERE `IF`=strDni; -END IF; - -SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - --- Tabla Trabajadores -IF (SELECT COUNT(*) FROM Trabajadores WHERE Nombre=strNombre AND Apellidos=strApellidos)=0 THEN - - IF strCodTrabajador IS NULL THEN - SET Cod_Trabajador = CONCAT(LEFT(strNombre, 1), LEFT(strApellidos, 1), MID(strApellidos, (LOCATE(' ', strApellidos) + 1), 1)); - END IF; - - IF (SELECT COUNT(*) FROM Trabajadores WHERE CodigoTrabajador=Cod_Trabajador) > 0 THEN - SET Cod_Trabajador = CONCAT(Cod_Trabajador, (FLOOR(RAND() * 100))); - END IF; - - SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - - INSERT INTO Trabajadores (CodigoTrabajador,Nombre,Apellidos,`Password`,dni,empresa_id,id_Cliente_Interno) - SELECT Cod_Trabajador,strNombre,strApellidos,LCASE(strPassword),strDni,intempresa_id,intId_Cliente; -ELSE - SET RETORNO="CodigoTrabajador Existente"; -END IF; - -- LEAVE SAMBA; -END; -- PROC - --- Tabla Account, lo crea como usuario y en samba --- Obtengo el nombre sin espacios -SET strSambaNombre = REPLACE(strNombre,' ',''); -IF (SELECT COUNT(*) FROM account.user WHERE `name`=convert(strNombre USING utf8) COLLATE utf8_general_ci)>0 THEN -- Si existe cojo la inicial del nombre+1º apellido - SELECT CONCAT(LEFT(strNombre,1),CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),intId_Cliente)) - INTO strSambaNombre; -END IF; - - IF (SELECT COUNT(*) FROM account.user where id=intId_Cliente)=0 THEN - INSERT INTO account.user (id,role,`name`,`password`,active) VALUES (intId_Cliente,1,lcase(strSambaNombre),MD5(LCASE(strPassword)),1); - INSERT INTO account.account (id,lastchange,`expire`,user_id) values (intId_Cliente,CURRENT_DATE(),CURRENT_DATE(),intId_Cliente); - UPDATE Trabajadores SET user_id=intId_Cliente WHERE Id_Cliente_Interno=intId_Cliente; - ELSE - INSERT INTO account.user (role,`name`,`password`,active) VALUES (1,lcase(strSambaNombre),MD5(LCASE(strPassword)),1); - SET tmpUserId = LAST_INSERT_ID(); - INSERT INTO account.account (id,lastchange,`expire`,user_id) values (tmpUserId,CURRENT_DATE(),CURRENT_DATE(),tmpUserId); - UPDATE Trabajadores SET user_id=tmpUserId WHERE Id_Cliente_Interno=intId_Cliente; - END IF; - - REPLACE INTO account.mailAliasAccount(mailAlias, account) VALUES (48,intId_Cliente); - -END; -- samba - -RETURN RETORNO; -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 DROP FUNCTION IF EXISTS `AltaEmpleadokk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `AltaEmpleadokk`(strCodTrabajador varchar(3),strNombre varchar(50),strApellidos varchar(50),strDni varchar(9), - strDomicilio longtext,strCodPostal varchar(5),strPoblacion varchar(25),provinceId smallint(5), intempresa_id smallint(5),strMovil varchar(11)) RETURNS varchar(50) CHARSET utf8 -BEGIN - -DECLARE RETORNO varchar(50) DEFAULT 'Empleado creado CORRECTAMENTE'; -DECLARE tmpUserId INT(11) DEFAULT 0; -DECLARE intId_Cliente int(11) DEFAULT 0; -DECLARE Cod_Trabajador VARCHAR(8) DEFAULT strCodTrabajador; -DECLARE strPassword VARCHAR(50); -DECLARE strSambaNombre VARCHAR(30); - -samba:BEGIN - -proc:BEGIN - -- IF (boolCrearSamba) THEN - -- SELECT Id_Cliente_Interno INTO intId_Cliente FROM Trabajadores WHERE Nombre=strNombre and Apellidos=strApellidos; - -- SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - -- LEAVE proc; - -- END IF; --- Tabla Clientes -SELECT COUNT(*) INTO intId_Cliente FROM Clientes WHERE `IF`=strDni; -IF (intId_Cliente=0) THEN - -- SELECT IFNULL(province_id,1) INTO intprovince_id FROM province WHERE `name`=strProvincia; - SELECT MAX(Id_Cliente)+1 INTO intId_Cliente FROM Clientes WHERE Id_Cliente<999999; - - INSERT INTO Clientes (Id_Cliente,Cliente,Domicilio,`IF`,Telefono,province_id,Poblacion,CodPostal,RazonSocial,Contacto,Oficial,Descuento) - SELECT intId_Cliente,Concat('TR ',strNombre,' ',StrApellidos),strDomicilio,strDni,strMovil,provinceId,strPoblacion,strCodPostal, - CONCAT(strApellidos,' ',strNombre),strNombre,1,3; -ELSE - SELECT id_cliente INTO intId_Cliente FROM Clientes WHERE `IF`=strDni; -END IF; - -SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - --- Tabla Trabajadores -IF (SELECT COUNT(*) FROM Trabajadores WHERE Nombre=strNombre AND Apellidos=strApellidos)=0 THEN - - IF strCodTrabajador IS NULL THEN - SET Cod_Trabajador = CONCAT(LEFT(strNombre, 1), LEFT(strApellidos, 1), MID(strApellidos, (LOCATE(' ', strApellidos) + 1), 1)); - END IF; - - IF (SELECT COUNT(*) FROM Trabajadores WHERE CodigoTrabajador=Cod_Trabajador) > 0 THEN - SET Cod_Trabajador = CONCAT(Cod_Trabajador, (FLOOR(RAND() * 100))); - END IF; - - SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - - INSERT INTO Trabajadores (CodigoTrabajador,Nombre,Apellidos,`Password`,dni,empresa_id,id_Cliente_Interno) - SELECT Cod_Trabajador,strNombre,strApellidos,LCASE(strPassword),strDni,intempresa_id,intId_Cliente; -ELSE - SET RETORNO="CodigoTrabajador Existente"; -END IF; - -- LEAVE SAMBA; -END; -- PROC - --- Tabla Account, lo crea como usuario y en samba --- Obtengo el nombre sin espacios -SET strSambaNombre = REPLACE(strNombre,' ',''); -IF (SELECT COUNT(*) FROM account.user WHERE `name`=convert(strNombre USING utf8) COLLATE utf8_general_ci)>0 THEN -- Si existe cojo la inicial del nombre+1º apellido - SELECT CONCAT(LEFT(strNombre,1),CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),intId_Cliente)) - INTO strSambaNombre; -END IF; - - IF (SELECT COUNT(*) FROM account.user where id=intId_Cliente)=0 THEN - INSERT INTO account.user (id,role,`name`,`password`,active) VALUES (intId_Cliente,1,lcase(strSambaNombre),MD5(LCASE(strPassword)),1); - INSERT INTO account.account (id,lastchange,`expire`,user_id) values (intId_Cliente,CURRENT_DATE(),CURRENT_DATE(),intId_Cliente); - UPDATE Trabajadores SET user_id=intId_Cliente WHERE Id_Cliente_Interno=intId_Cliente; - ELSE - INSERT INTO account.user (role,`name`,`password`,active) VALUES (1,lcase(strSambaNombre),MD5(LCASE(strPassword)),1); - SET tmpUserId = LAST_INSERT_ID(); - INSERT INTO account.account (id,lastchange,`expire`,user_id) values (tmpUserId,CURRENT_DATE(),CURRENT_DATE(),tmpUserId); - UPDATE Trabajadores SET user_id=tmpUserId WHERE Id_Cliente_Interno=intId_Cliente; - END IF; - - REPLACE INTO account.mailAliasAccount(mailAlias, account) VALUES (48,intId_Cliente); - -END; -- samba - -RETURN RETORNO; -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 DROP FUNCTION IF EXISTS `articod` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -13298,12 +13769,12 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `articod`(intArt INT) RETURNS varchar(70) CHARSET utf8 COLLATE utf8_unicode_ci -BEGIN - DECLARE strArt VARCHAR(70); - SELECT CONCAT(Article,' ', Medida, ' ',Color) INTO strArt FROM Articles WHERE Id_Article = intArt; - - RETURN strArt; - +BEGIN + DECLARE strArt VARCHAR(70); + SELECT CONCAT(Article,' ', Medida, ' ',Color) INTO strArt FROM Articles WHERE Id_Article = intArt; + + RETURN strArt; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -13823,7 +14294,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `CM3` */; +/*!50003 DROP FUNCTION IF EXISTS `cm3` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -13833,16 +14304,16 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `CM3`(v_buy_id INT) RETURNS int(11) -BEGIN - DECLARE id_CUB VARCHAR(10); - DECLARE id_ART INT; - SELECT Id_Cubo, Id_Article INTO id_CUB, id_ART - FROM Compres c - WHERE c.Id_compra = v_buy_id; - - RETURN cm3_2(id_CUB, id_ART); - +CREATE DEFINER=`root`@`%` FUNCTION `cm3`(v_buy_id INT) RETURNS int(11) +BEGIN + DECLARE id_CUB VARCHAR(10); + DECLARE id_ART INT; + SELECT Id_Cubo, Id_Article INTO id_CUB, id_ART + FROM Compres c + WHERE c.Id_compra = v_buy_id; + + RETURN cm3_2(id_CUB, id_ART); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -13889,17 +14360,17 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `cm3_unidad`(v_buy_id INT) RETURNS int(11) -BEGIN - DECLARE id_CUB VARCHAR(10); +BEGIN + DECLARE id_CUB VARCHAR(10); DECLARE id_ART INT; DECLARE intPACK INT; - - SELECT Id_Cubo, Id_Article, Packing INTO id_CUB, id_ART, intPACK - FROM Compres c - WHERE c.Id_compra = v_buy_id; - - RETURN ifnull(round(cm3_2(id_CUB, id_ART)/intPACK),0); - + + SELECT Id_Cubo, Id_Article, Packing INTO id_CUB, id_ART, intPACK + FROM Compres c + WHERE c.Id_compra = v_buy_id; + + RETURN ifnull(round(cm3_2(id_CUB, id_ART)/intPACK),0); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14048,7 +14519,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `date_inv`() RETURNS datetime DETERMINISTIC -BEGIN +BEGIN RETURN (SELECT FechaInventario FROM tblContadores LIMIT 1); END ;; DELIMITER ; @@ -14068,8 +14539,8 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `DAYEND`(v_date DATE) RETURNS datetime DETERMINISTIC -BEGIN - RETURN TIMESTAMP(v_date,'23:59:59'); +BEGIN + RETURN TIMESTAMP(v_date,'23:59:59'); END ;; DELIMITER ; @@ -14114,16 +14585,16 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `f_periodo`(datFEC date) RETURNS int(7) DETERMINISTIC -BEGIN +BEGIN DECLARE intPeriod INT; SELECT Year(datFEC) * 100 + week(datFEC) into intPeriod; -RETURN intPeriod; - - - - +RETURN intPeriod; + + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14163,6 +14634,37 @@ BEGIN SET bouquetId = (SELECT @vItem); RETURN bouquetId; +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 DROP FUNCTION IF EXISTS `getComision` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `getComision`(vEntry INT, vMoneda INT) RETURNS int(11) +BEGIN + + DECLARE vComision INT; + + SELECT IFNULL(round(-100 * (1 - (1 / rm.rate))),0) INTO vComision + FROM Entradas e + JOIN travel tr ON tr.id = e.travel_id + LEFT JOIN reference_min rm ON rm.moneda_id = vMoneda AND tr.shipment >= rm.`date` + WHERE e.Id_Entrada = vEntry + ORDER BY rm.date DESC + LIMIT 1; + + RETURN vComision; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14466,7 +14968,7 @@ BEGIN SET dblRESULT = IFNULL(dblCANTIDAD,0); - RETURN dblRESULT; + RETURN dblRESULT; END ;; DELIMITER ; @@ -14491,7 +14993,7 @@ DECLARE vDued DATE; SET vDued = vn.getDueDate(vDated, vDayToPay); -RETURN vDued; +RETURN vDued; END ;; DELIMITER ; @@ -14652,21 +15154,21 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` 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; - +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 DROP FUNCTION IF EXISTS `risk` */; +/*!50003 DROP FUNCTION IF EXISTS `riskKk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -14676,7 +15178,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `risk`(datMax DATE, intCustomer INT) RETURNS decimal(10,2) +CREATE DEFINER=`root`@`%` FUNCTION `riskKk`(datMax DATE, intCustomer INT) RETURNS decimal(10,2) BEGIN /** * Deprecated @@ -14787,12 +15289,17 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `ticket_freight`(idT INT) RETURNS decimal(10,3) BEGIN + + DECLARE dblFreight DECIMAL(10,2); + + /* DECLARE intWh INTEGER; DECLARE datFecha DATE; - DECLARE dblFreight DECIMAL(10,2); + SELECT warehouse_id, Fecha INTO intWh,datFecha FROM Tickets WHERE Id_Ticket = idT; + CALL item_last_buy_(intWh,datFecha); SELECT SUM((`M`.`Cantidad` * (CM3(`b`.`buy_id`) / 1000000 /`C`.`Packing`) * `az`.`price` / 0.08)) INTO dblFreight @@ -14812,7 +15319,13 @@ BEGIN WHERE M.Id_Ticket = idT; DROP TEMPORARY TABLE t_item_last_buy; - + */ + + SELECT sum(freight) + INTO dblFreight + FROM v_Movimientos_Volumen_shipping_charge + WHERE Id_Ticket = idT; + RETURN dblFreight; END ;; @@ -14831,32 +15344,32 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `ticket_state`( - strFAC VARCHAR(15), - intIMP TINYINT(1), - intETI TINYINT(1), - intBLO TINYINT(1) - +CREATE DEFINER=`root`@`%` FUNCTION `ticket_state`( + strFAC VARCHAR(15), + intIMP TINYINT(1), + intETI TINYINT(1), + intBLO TINYINT(1) + ) RETURNS varchar(15) CHARSET utf8 -BEGIN -CASE - - WHEN strFAC IS NOT NULL AND strFAC != '' THEN RETURN 'FACTURADO'; - - WHEN intETI <> 0 THEN RETURN 'ALBARAN'; - - WHEN intIMP <> 0 THEN RETURN 'PREPARACION'; - - WHEN intBLO <> 0 THEN RETURN 'BLOQUEADO'; - - ELSE RETURN 'LIBRE'; - -END CASE; - - - - - +BEGIN +CASE + + WHEN strFAC IS NOT NULL AND strFAC != '' THEN RETURN 'FACTURADO'; + + WHEN intETI <> 0 THEN RETURN 'ALBARAN'; + + WHEN intIMP <> 0 THEN RETURN 'PREPARACION'; + + WHEN intBLO <> 0 THEN RETURN 'BLOQUEADO'; + + ELSE RETURN 'LIBRE'; + +END CASE; + + + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14967,25 +15480,37 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `ticket_total`(ticket_id INT) RETURNS double BEGIN +/** + * Calcula el total con IVA de un ticket. + * + * @deprecated Use function vn.ticketGetTotal() instead + * + * @param ticket_id Identificador del ticket + * @return Total del ticket + */ + -- TODO: Una vez provado el nuevo método con esta instrucción es suficiente + -- RETURN vn.ticketGetTotal (vTicketId); + DECLARE v_total DOUBLE; DROP TEMPORARY TABLE IF EXISTS ticket_tmp; CREATE TEMPORARY TABLE ticket_tmp - (INDEX idx USING HASH (ticket_id)) - ENGINE = MEMORY - SELECT ticket_id; + (INDEX (ticket_id)) + ENGINE = MEMORY + SELECT ticket_id; - CALL ticket_total (); + CALL ticket_total; SELECT total INTO v_total FROM ticket_total; - DROP TEMPORARY TABLE ticket_total; - DROP TEMPORARY TABLE ticket_tmp; + DROP TEMPORARY TABLE + ticket_total, + ticket_tmp; RETURN v_total; END ;; @@ -15442,7 +15967,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `abono` */; +/*!50003 DROP FUNCTION IF EXISTS `__AltaEmpleado` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -15452,34 +15977,85 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `abono`(IN idT MEDIUMINT, IN idUSER SMALLINT) +CREATE DEFINER=`root`@`%` FUNCTION `__AltaEmpleado`(strCodTrabajador varchar(3),strNombre varchar(50),strApellidos varchar(50),strDni varchar(9), + strDomicilio longtext,strCodPostal varchar(5),strPoblacion varchar(25),provinceId smallint(5), intempresa_id smallint(5),strMovil varchar(11)) RETURNS varchar(50) CHARSET utf8 BEGIN --- OBSOLETO USAR vn.refund() - DECLARE idC MEDIUMINT; - DECLARE newFEC DATE; - DECLARE idWH TINYINT; - DECLARE idUSER SMALLINT; - DECLARE idEMP MEDIUMINT; - DECLARE idCON MEDIUMINT; - DECLARE newTICKET MEDIUMINT; +DECLARE RETORNO varchar(50) DEFAULT 'Empleado creado CORRECTAMENTE'; +DECLARE tmpUserId INT(11) DEFAULT 0; +DECLARE intId_Cliente int(11) DEFAULT 0; +DECLARE Cod_Trabajador VARCHAR(8) DEFAULT strCodTrabajador; +DECLARE strPassword VARCHAR(50); +DECLARE strSambaNombre VARCHAR(30); - SELECT Id_Cliente, TIMESTAMPADD(DAY, 1,Fecha), warehouse_id, empresa_id, Id_Consigna INTO idC, newFEC, idWH, idEMP, idCON - FROM Tickets WHERE Id_Ticket = idT; +samba:BEGIN + +proc:BEGIN + -- IF (boolCrearSamba) THEN + -- SELECT Id_Cliente_Interno INTO intId_Cliente FROM Trabajadores WHERE Nombre=strNombre and Apellidos=strApellidos; + -- SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; + -- LEAVE proc; + -- END IF; +-- Tabla Clientes +SELECT COUNT(*) INTO intId_Cliente FROM Clientes WHERE `IF`=strDni; +IF (intId_Cliente=0) THEN + -- SELECT IFNULL(province_id,1) INTO intprovince_id FROM province WHERE `name`=strProvincia; + SELECT MAX(Id_Cliente)+1 INTO intId_Cliente FROM Clientes WHERE Id_Cliente<999999; - SELECT Id_Trabajador into idUSER from Trabajadores where user_id = account.userGetId(); - IF idUSER IS NULL THEN - SET idUSER = 20; + INSERT INTO Clientes (Id_Cliente,Cliente,Domicilio,`IF`,Telefono,province_id,Poblacion,CodPostal,RazonSocial,Contacto,Oficial,Descuento) + SELECT intId_Cliente,Concat('TR ',strNombre,' ',StrApellidos),strDomicilio,strDni,strMovil,provinceId,strPoblacion,strCodPostal, + CONCAT(strApellidos,' ',strNombre),strNombre,1,3; +ELSE + SELECT id_cliente INTO intId_Cliente FROM Clientes WHERE `IF`=strDni; +END IF; + +SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; + +-- Tabla Trabajadores +IF (SELECT COUNT(*) FROM Trabajadores WHERE Nombre=strNombre AND Apellidos=strApellidos)=0 THEN + + IF strCodTrabajador IS NULL THEN + SET Cod_Trabajador = CONCAT(LEFT(strNombre, 1), LEFT(strApellidos, 1), MID(strApellidos, (LOCATE(' ', strApellidos) + 1), 1)); + END IF; + + IF (SELECT COUNT(*) FROM Trabajadores WHERE CodigoTrabajador=Cod_Trabajador) > 0 THEN + SET Cod_Trabajador = CONCAT(Cod_Trabajador, (FLOOR(RAND() * 100))); END IF; - - CALL ticket_new_complet(idC, newFEC, idWH, idUSER, idEMP, idCON, 23,NULL,newTICKET); - UPDATE Tickets SET Etiquetasemitidas = 1 WHERE Id_Ticket = newTICKET; + SELECT CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),'.',intId_Cliente) INTO strPassword; - INSERT INTO Movimientos(Id_Ticket, Id_Article, Cantidad, Concepte, Preu, Descuento, PrecioFijado) - SELECT newTICKET, Id_Article, -1 * Cantidad, Concepte, Preu, Descuento, 1 FROM Movimientos WHERE Id_Ticket = idT; - SELECT newTICKET; + INSERT INTO Trabajadores (CodigoTrabajador,Nombre,Apellidos,`Password`,dni,empresa_id,id_Cliente_Interno) + SELECT Cod_Trabajador,strNombre,strApellidos,LCASE(strPassword),strDni,intempresa_id,intId_Cliente; +ELSE + SET RETORNO="CodigoTrabajador Existente"; +END IF; + -- LEAVE SAMBA; +END; -- PROC +-- Tabla Account, lo crea como usuario y en samba +-- Obtengo el nombre sin espacios +SET strSambaNombre = REPLACE(strNombre,' ',''); +IF (SELECT COUNT(*) FROM account.user WHERE `name`=convert(strNombre USING utf8) COLLATE utf8_general_ci)>0 THEN -- Si existe cojo la inicial del nombre+1º apellido + SELECT CONCAT(LEFT(strNombre,1),CONCAT(IF(INSTR(StrApellidos,' ')=0,StrApellidos,LEFT(strApellidos,INSTR(StrApellidos,' ')-1)),intId_Cliente)) + INTO strSambaNombre; +END IF; + + IF (SELECT COUNT(*) FROM account.user where id=intId_Cliente)=0 THEN + INSERT INTO account.user (id,role,`name`,`password`,active) VALUES (intId_Cliente,1,lcase(strSambaNombre),MD5(LCASE(strPassword)),1); + INSERT INTO account.account (id,lastchange,`expire`,user_id) values (intId_Cliente,CURRENT_DATE(),CURRENT_DATE(),intId_Cliente); + UPDATE Trabajadores SET user_id=intId_Cliente WHERE Id_Cliente_Interno=intId_Cliente; + ELSE + INSERT INTO account.user (role,`name`,`password`,active) VALUES (1,lcase(strSambaNombre),MD5(LCASE(strPassword)),1); + SET tmpUserId = LAST_INSERT_ID(); + INSERT INTO account.account (id,lastchange,`expire`,user_id) values (tmpUserId,CURRENT_DATE(),CURRENT_DATE(),tmpUserId); + UPDATE Trabajadores SET user_id=tmpUserId WHERE Id_Cliente_Interno=intId_Cliente; + END IF; + + REPLACE INTO account.mailAliasAccount(mailAlias, account) VALUES (48,intId_Cliente); + +END; -- samba + +RETURN RETORNO; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15584,6 +16160,56 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `add_awb_component`(IN v_awb SMALLINT) +BEGIN + + DECLARE vShipment DATE; + SELECT t.shipment INTO vShipment + FROM awb_recibida aw + JOIN recibida_entrada re ON re.awb_recibida = aw.recibida_id + JOIN Entradas e ON e.Id_Entrada = re.Id_Entrada + JOIN travel t ON t.id = e.travel_id + WHERE awb_id = v_awb limit 1; + + INSERT IGNORE INTO awb_component (awb_id,Id_Proveedor,awb_component_type_id,awb_role_id,awb_unit_id,value,Id_Moneda) + SELECT id,Id_Proveedor,awb_component_type_id,awb_role_id,awb_unit_id,LEAST(GREATEST(value1,IFNULL(min_value,value1)),IFNULL(max_value,value1)),Id_Moneda + FROM ( + SELECT a.id,IFNULL(act.carguera_id,CASE awb_role_id WHEN 1 THEN a.carguera_id WHEN 2 THEN a.transitario_id WHEN 3 THEN f.airline_id END) Id_Proveedor, + act.awb_component_type_id,act.awb_role_id,act.awb_unit_id, value * + CASE awb_unit_id + WHEN '1000Tj-20' THEN ((CAST(stems AS SIGNED) - 20000)/1000) + (min_value / value) + WHEN '1000Tj-10' THEN ((CAST(stems AS SIGNED) - 10000)/1000) + (min_value / value) + WHEN '100GW' THEN peso/100 + WHEN 'AWB' THEN 1 -- No action + WHEN 'FB' THEN hb/2 + WHEN 'GW' THEN peso + WHEN 'TW' THEN GREATEST(peso,volume_weight) + END value1 + , value, + act.Id_Moneda, act.min_value, act.max_value + FROM awb a JOIN flight f ON f.flight_id = a.flight_id + LEFT JOIN awb_component_template act ON ((IFNULL(act.carguera_id, a.carguera_id) = a.carguera_id AND awb_role_id = 1) + OR (IFNULL(act.carguera_id, a.transitario_id) = a.transitario_id AND awb_role_id = 2)) + AND IFNULL(act.airport_out, f.airport_out) = f.airport_out AND IFNULL(act.airport_in, f.airport_in) = f.airport_in + AND IFNULL(act.airline_id, f.airline_id) = f.airline_id + WHERE a.id = v_awb AND Fecha <= vShipment ORDER BY Fecha DESC) 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 DROP PROCEDURE IF EXISTS `add_awb_componentKK` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `add_awb_componentKK`(IN v_awb SMALLINT) BEGIN INSERT IGNORE INTO awb_component (awb_id,Id_Proveedor,awb_component_type_id,awb_role_id,awb_unit_id,value,Id_Moneda) @@ -15886,7 +16512,7 @@ BEGIN FROM agenVOL a JOIN Agencias agen USING(Id_Agencia) JOIN agency ag USING(agency_id) - GROUP BY ag.agency_id/*, Prioridad*/ ; + GROUP BY ag.agency_id/*, Prioridad*/; DROP TEMPORARY TABLE IF EXISTS agenVOL; END ;; @@ -15979,13 +16605,13 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `article`() BEGIN - DROP TEMPORARY TABLE IF EXISTS `article_inventory`; - CREATE TEMPORARY TABLE `article_inventory` - ( - `article_id` INT(11) NOT NULL PRIMARY KEY, - `future` DATETIME - ) - ENGINE = MEMORY; + DROP TEMPORARY TABLE IF EXISTS `article_inventory`; + CREATE TEMPORARY TABLE `article_inventory` + ( + `article_id` INT(11) NOT NULL PRIMARY KEY, + `future` DATETIME + ) + ENGINE = MEMORY; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16163,12 +16789,12 @@ proc: BEGIN UPDATE tblContadores SET FechaInventario = vDate; - DELETE e + DELETE e, t FROM travel t JOIN Entradas e ON e.travel_id = t.id WHERE Id_Proveedor = 4 AND shipment <= vDeleteDate - AND (DAY(shipment) <> 1 OR shipment < TIMESTAMPADD(MONTH, -5, CURDATE())); + AND (DAY(shipment) <> 1 OR shipment < TIMESTAMPADD(MONTH, -12, CURDATE())); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16312,39 +16938,39 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `article_multiple_buy_date`(IN date_ DATETIME, IN wh TINYINT(3)) -BEGIN - - DECLARE datINV DATE; +BEGIN + + DECLARE datINV DATE; SELECT FechaInventario INTO datINV FROM tblContadores; + + ALTER TABLE `article_inventory` + ADD `buy_date` datetime NOT NULL; - ALTER TABLE `article_inventory` - ADD `buy_date` datetime NOT NULL; + UPDATE article_inventory INNER JOIN + ( - UPDATE article_inventory INNER JOIN - ( - - SELECT * FROM - ( - SELECT travel.landing AS bdate, Compres.Id_Article AS article_id - FROM Compres - JOIN Entradas USING(Id_Entrada) + SELECT * FROM + ( + SELECT travel.landing AS bdate, Compres.Id_Article AS article_id + FROM Compres + JOIN Entradas USING(Id_Entrada) JOIN travel ON travel.id = Entradas.travel_id - JOIN warehouse W ON W.id = travel.warehouse_id + JOIN warehouse W ON W.id = travel.warehouse_id WHERE travel.landing BETWEEN datINV AND date_ - AND IF(wh = 0, W.comisionantes, wh = travel.warehouse_id) - /*AND Compres.Novincular = FALSE - AND Entradas.Id_Proveedor <> 4 + AND IF(wh = 0, W.comisionantes, wh = travel.warehouse_id) + /*AND Compres.Novincular = FALSE + AND Entradas.Id_Proveedor <> 4 AND Entradas.Inventario = FALSE*/ - -- jgf 2017/03/06 en la comparativa no trau el dia de caducitat - AND Entradas.Redada = FALSE - ORDER BY article_id, bdate DESC - - ) AS temp - GROUP BY article_id - ) - AS buy ON article_inventory.article_id = buy.article_id - SET article_inventory.buy_date = buy.bdate; + -- jgf 2017/03/06 en la comparativa no trau el dia de caducitat + AND Entradas.Redada = FALSE + ORDER BY article_id, bdate DESC + + ) AS temp + GROUP BY article_id + ) + AS buy ON article_inventory.article_id = buy.article_id + SET article_inventory.buy_date = buy.bdate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16362,22 +16988,22 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `article_multiple_buy_last`(IN wh TINYINT, IN date_end DATETIME) -BEGIN +BEGIN DECLARE v_date DATETIME; - DROP TEMPORARY TABLE IF EXISTS article_buy_last; - CREATE TEMPORARY TABLE article_buy_last - SELECT * FROM ( - SELECT c.Id_Article AS article_id, c.Id_Compra AS id - FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) - INNER JOIN travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN date_inv() AND date_end - AND c.Novincular = FALSE - AND c.tarifa2 > 0 - ORDER BY t.landing DESC,(wh IN (0,t.warehouse_id)) DESC, (Id_Cubo IS NULL) ,article_id, (e.Id_proveedor = 4) - ) t - GROUP BY article_id; - ALTER TABLE article_buy_last ADD INDEX (article_id); + DROP TEMPORARY TABLE IF EXISTS article_buy_last; + CREATE TEMPORARY TABLE article_buy_last + SELECT * FROM ( + SELECT c.Id_Article AS article_id, c.Id_Compra AS id + FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) + INNER JOIN travel t ON t.id = e.travel_id + WHERE t.landing BETWEEN date_inv() AND date_end + AND c.Novincular = FALSE + AND c.tarifa2 > 0 + ORDER BY t.landing DESC,(wh IN (0,t.warehouse_id)) DESC, (Id_Cubo IS NULL) ,article_id, (e.Id_proveedor = 4) + ) t + GROUP BY article_id; + ALTER TABLE article_buy_last ADD INDEX (article_id); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16421,19 +17047,19 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `article_visible_single2`(IN v_wh TINYINT,IN v_article INT,OUT int_amount INT) -BEGIN +BEGIN - call item_stock(v_wh,CURDATE(),v_article); - call article_visible(v_wh); - - SELECT SUM(stock) INTO int_amount FROM tmp_item WHERE item_id = v_article ; + call item_stock(v_wh,CURDATE(),v_article); + call article_visible(v_wh); + + SELECT SUM(stock) INTO int_amount FROM tmp_item WHERE item_id = v_article ; SELECT IFNULL(SUM(amount),0) + IFNULL(int_amount,0) INTO int_amount FROM article_visible - WHERE article_id = v_article; - - DROP TEMPORARY TABLE tmp_item; - DROP TEMPORARY TABLE article_visible; + WHERE article_id = v_article; + DROP TEMPORARY TABLE tmp_item; + DROP TEMPORARY TABLE article_visible; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16471,8 +17097,8 @@ proc: BEGIN SELECT FechaInventario INTO v_date_inv FROM vn2008.tblContadores; - SELECT SUBTIME(NOW(), reserve_time) INTO v_reserve_date - FROM hedera.order_config; + SELECT SUBTIME(NOW(), reserveTime) INTO v_reserve_date + FROM hedera.orderConfig; -- Calcula el ultimo dia de vida para cada producto @@ -16612,201 +17238,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `availableTraslatekk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `availableTraslatekk`(vWarehouseLanding INT, v_date DATE,vWarehouseShipment INT) -proc: BEGIN - DECLARE v_date_ini DATE; - DECLARE v_date_end DATETIME; - DECLARE v_reserve_date DATETIME; - DECLARE v_date_inv DATE; - - IF v_date < CURDATE() - THEN - LEAVE proc; - END IF; - - CALL vn2008.item_stock (vWarehouseLanding, v_date, NULL); - - -- Calcula algunos parámetros necesarios - - SET v_date_ini = TIMESTAMP(v_date, '00:00:00'); - SET v_date_end = TIMESTAMP(TIMESTAMPADD(DAY, 4, v_date), '23:59:59'); - - SELECT FechaInventario INTO v_date_inv FROM vn2008.tblContadores; - - SELECT SUBTIME(NOW(), reserve_time) INTO v_reserve_date - FROM hedera.order_config; - - -- Calcula el ultimo dia de vida para cada producto - - DROP TEMPORARY TABLE IF EXISTS item_range; - CREATE TEMPORARY TABLE item_range - (PRIMARY KEY (item_id)) - ENGINE = MEMORY - SELECT c.Id_Article item_id, MAX(landing) date_end - FROM vn2008.Compres c - JOIN vn2008.Entradas e ON c.Id_Entrada = e.Id_Entrada - JOIN vn2008.travel t ON t.id = e.travel_id - JOIN vn2008.warehouse w ON w.id = t.warehouse_id - WHERE t.landing BETWEEN v_date_inv AND v_date_ini - AND t.warehouse_id = vWarehouseLanding - AND NOT e.Inventario - AND NOT e.Redada - GROUP BY Id_Article; - - SELECT c.Id_Article item_id, MAX(landing) date_end - FROM vn2008.Compres c - JOIN vn2008.Entradas e ON c.Id_Entrada = e.Id_Entrada - JOIN vn2008.travel t ON t.id = e.travel_id - JOIN vn2008.warehouse w ON w.id = t.warehouse_id - WHERE t.landing BETWEEN v_date_inv AND v_date_ini - AND t.warehouse_id = vWarehouseLanding - AND NOT e.Inventario - AND NOT e.Redada - GROUP BY Id_Article; - - - -- Tabla con el ultimo dia de last_buy para cada producto que hace un replace de la anterior - - CALL item_last_buy_(vWarehouseShipment,curdate()); - - DROP TEMPORARY TABLE IF EXISTS item_range_copy; - CREATE TEMPORARY TABLE item_range_copy LIKE item_range; - INSERT INTO item_range_copy - SELECT * FROM item_range; - - INSERT INTO item_range - SELECT t.item_id, tr.landing - FROM t_item_last_buy t - JOIN Compres c ON c.Id_Compra = t.buy_id - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel tr ON tr.id = e.travel_id - LEFT JOIN item_range_copy i ON t.item_id = i.item_id - WHERE t.warehouse_id = vWarehouseShipment - ON DUPLICATE KEY UPDATE item_range.date_end = GREATEST(item_range.date_end,landing); - - - - SELECT t.item_id, tr.landing - FROM t_item_last_buy t - JOIN Compres c ON c.Id_Compra = t.buy_id - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel tr ON tr.id = e.travel_id - LEFT JOIN item_range_copy i ON t.item_id = i.item_id - WHERE t.warehouse_id = vWarehouseShipment; - - DROP TEMPORARY TABLE item_range_copy; - - -- Replica la tabla item_range para poder usarla varias veces en la misma consulta - - DROP TEMPORARY TABLE IF EXISTS item_range_copy1; - CREATE TEMPORARY TABLE item_range_copy1 LIKE item_range; - INSERT INTO item_range_copy1 - SELECT c.item_id, TIMESTAMP(TIMESTAMPADD(DAY, t.life, c.date_end), '23:59:59') date_end FROM item_range c - JOIN vn2008.Articles a ON a.Id_Article = c.item_id - JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - HAVING date_end >= v_date_ini OR date_end IS NULL; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy2; - CREATE TEMPORARY TABLE item_range_copy2 LIKE item_range_copy1; - INSERT INTO item_range_copy2 - SELECT * FROM item_range_copy1; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy3; - CREATE TEMPORARY TABLE item_range_copy3 LIKE item_range_copy1; - INSERT INTO item_range_copy3 - SELECT * FROM item_range_copy1; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy4; - CREATE TEMPORARY TABLE item_range_copy4 LIKE item_range_copy1; - INSERT INTO item_range_copy4 - SELECT * FROM item_range_copy1; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy5; - CREATE TEMPORARY TABLE item_range_copy5 LIKE item_range_copy1; - INSERT INTO item_range_copy5 - SELECT * FROM item_range_copy1; - - -- Calcula el ATP -SELECT item_id, stock,'tmp_item' - FROM vn2008.tmp_item; - - DROP TEMPORARY TABLE IF EXISTS availableTraslate; - CREATE TEMPORARY TABLE availableTraslate - (PRIMARY KEY (item_id)) - ENGINE = MEMORY - SELECT t.item_id, SUM(stock) available FROM ( - SELECT ti.item_id, stock - FROM vn2008.tmp_item ti - JOIN item_range ir ON ir.item_id = ti.item_id - UNION ALL - SELECT t.item_id, minacum(dt, amount, v_date) AS available FROM ( - SELECT item_id, DATE(dat) dt, SUM(amount) amount FROM ( - SELECT i.item_id, i.dat, i.amount - FROM vn2008.item_out i - JOIN item_range_copy1 ir ON ir.item_id = i.item_id - WHERE i.dat >= v_date_ini - AND (ir.date_end IS NULL OR i.dat <= ir.date_end) - AND i.warehouse_id = vWarehouseLanding - UNION ALL - SELECT i.item_id, i.dat, i.amount - FROM vn2008.item_entry_in i - JOIN item_range_copy2 ir ON ir.item_id = i.item_id - WHERE i.dat >= v_date_ini - AND (ir.date_end IS NULL OR i.dat <= ir.date_end) - AND i.warehouse_id = vWarehouseLanding - UNION ALL - SELECT i.item_id, i.dat, i.amount - FROM vn2008.item_entry_out i - JOIN item_range_copy3 ir ON ir.item_id = i.item_id - WHERE i.dat >= v_date_ini - AND (ir.date_end IS NULL OR i.dat <= ir.date_end) - AND i.warehouse_id = vWarehouseLanding - UNION ALL - SELECT r.item_id, r.shipment, -r.amount - FROM hedera.order_row r - JOIN hedera.`order` o ON o.id = r.order_id - JOIN item_range_copy4 ir ON ir.item_id = r.item_id - WHERE r.shipment >= v_date_ini - AND (ir.date_end IS NULL OR r.shipment <= ir.date_end) - AND r.warehouse_id = vWarehouseLanding - AND r.created >= v_reserve_date - AND NOT o.confirmed - ) t - GROUP BY item_id, dt - ) t - GROUP BY t.item_id - ) t GROUP BY t.item_id HAVING available != 0; -SELECT i.item_id, i.dat, i.amount,'item_out',vWarehouseLanding - FROM vn2008.item_out i - JOIN item_range_copy1 ir ON ir.item_id = i.item_id - WHERE i.dat >= v_date_ini - AND (ir.date_end IS NULL OR i.dat <= ir.date_end) - AND i.warehouse_id = vWarehouseLanding; -select * from availableTraslate; - DROP TEMPORARY TABLE - vn2008.tmp_item - ,item_range - ,item_range_copy1 - ,item_range_copy2 - ,item_range_copy3 - ,item_range_copy4 - ,item_range_copy5; -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 DROP PROCEDURE IF EXISTS `availableTraslateTesting` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -16838,8 +17269,8 @@ proc: BEGIN SELECT FechaInventario INTO v_date_inv FROM vn2008.tblContadores; - SELECT SUBTIME(NOW(), reserve_time) INTO v_reserve_date - FROM hedera.order_config; + SELECT SUBTIME(NOW(), reserveTime) INTO v_reserve_date + FROM hedera.orderConfig; -- Calcula el ultimo dia de vida para cada producto @@ -17057,8 +17488,8 @@ DECLARE strTABLE VARCHAR(20) DEFAULT "balance_nest_tree"; DECLARE intGAP INTEGER DEFAULT 7; DECLARE intYEARS INTEGER DEFAULT 3; DECLARE vConsolidatedGroup INTEGER; -DECLARE vStartingDate DATE DEFAULT '2015-01-01'; -DECLARE vStartingYear INT DEFAULT 2015; +DECLARE vStartingDate DATE DEFAULT '2016-01-01'; +DECLARE vStartingYear INT DEFAULT 2016; -- Solicitamos la tabla tmp.nest, como base para el balance @@ -17097,25 +17528,37 @@ IF NOT vInterGroupSalesIncluded THEN END IF; -- Se calculan las facturas que intervienen, para luego poder servir el desglose desde aqui + DROP TEMPORARY TABLE IF EXISTS tmp.balance_desglose; CREATE TEMPORARY TABLE tmp.balance_desglose SELECT er.empresa_id as receptora_id , ee.empresa_id as emisora_id - , year(IFNULL(IFNULL(tr.dateBooking,tr.Fecha),IFNULL(r.dateBooking,r.Fecha))) as `year` - , month(IFNULL(IFNULL(tr.dateBooking,tr.Fecha),IFNULL(r.dateBooking,r.Fecha))) as `month` + , year(IFNULL(r.bookEntried,IFNULL(r.dateBooking, r.Fecha))) as `year` + , month(IFNULL(r.bookEntried,IFNULL(r.dateBooking, r.Fecha))) as `month` , gastos_id as Id_Gasto , sum(bi) as importe FROM recibida r JOIN recibida_iva ri on ri.recibida_id = r.id JOIN tmp.empresas_receptoras er on er.empresa_id = r.empresa_id JOIN tmp.empresas_emisoras ee ON ee.empresa_id = r.proveedor_id - LEFT JOIN vn2008.recibida_entrada re ON re.recibida_id = r.id - LEFT JOIN vn2008.recibida tr ON tr.id = re.awb_recibida - WHERE IFNULL(r.dateBooking,r.Fecha) between vStartingDate and CURDATE() + WHERE IFNULL(r.bookEntried,IFNULL(r.dateBooking, r.Fecha)) between vStartingDate and CURDATE() GROUP BY Id_Gasto, year, month, emisora_id, receptora_id; - - - +/* +DROP TEMPORARY TABLE IF EXISTS tmp.balance_desglose; +CREATE TEMPORARY TABLE tmp.balance_desglose + SELECT er.empresa_id as receptora_id + , ee.empresa_id as emisora_id + , year(IFNULL(r.dateBooking, r.Fecha)) as `year` + , month(IFNULL(r.dateBooking, r.Fecha)) as `month` + , gastos_id as Id_Gasto + , sum(bi) as importe + FROM recibida r + JOIN recibida_iva ri on ri.recibida_id = r.id + JOIN tmp.empresas_receptoras er on er.empresa_id = r.empresa_id + JOIN tmp.empresas_emisoras ee ON ee.empresa_id = r.proveedor_id + WHERE IFNULL(r.dateBooking, r.Fecha) between vStartingDate and CURDATE() + GROUP BY Id_Gasto, year, month, emisora_id, receptora_id; +*/ INSERT INTO tmp.balance_desglose(receptora_id , emisora_id , year @@ -17156,7 +17599,7 @@ SET v_sql = sql_printf ( YEAR(CURDATE()) ); -CALL sql_query (v_sql); +CALL util.exec (v_sql); -- Añadimos los gastos, para facilitar el formulario @@ -17191,7 +17634,7 @@ WHILE intYEARS > 0 DO YEAR(CURDATE()) - intYEARS ); - CALL sql_query (v_sql); + CALL util.exec (v_sql); END WHILE; @@ -17230,7 +17673,7 @@ END WHILE; ); - CALL sql_query (v_sql); + CALL util.exec (v_sql); -- Ventas intra grupo IF NOT vInterGroupSalesIncluded THEN @@ -17254,11 +17697,11 @@ CREATE TEMPORARY TABLE tmp.balance_aux SELECT * FROM tmp.balance; UPDATE tmp.balance b JOIN ( -select b1.id, b1.name, sum(b2.`2015`) as `2015`, sum(b2.`2016`) as `2016`, sum(b2.`2017`) as `2017` +select b1.id, b1.name, sum(b2.`2016`) as `2016`, sum(b2.`2017`) as `2017`, sum(b2.`2018`) as `2018` from tmp.nest b1 join tmp.balance_aux b2 on b2.lft between b1.lft and b1.rgt group by b1.id) sub on sub.id = b.id -SET b.`2015` = sub.`2015`, b.`2016` = sub.`2016`, b.`2017` = sub.`2017` +SET b.`2016` = sub.`2016`, b.`2017` = sub.`2017`, b.`2018` = sub.`2018` ; @@ -17305,12 +17748,12 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `bionic_available_`( - v_date DATE, - v_consigna INT, - v_agencia INT) + vDate DATE, + vAddress INT, + vAgency INT) BEGIN /** * Calcula el disponible para un conjunto de almacenes y fechas @@ -17318,22 +17761,22 @@ BEGIN * * @table t_bionic_available Tabla con los ids de cache **/ - - DECLARE v_available_calc INT; - DECLARE v_shipment DATE; - DECLARE v_agency_id INT; - DECLARE v_wh INT; - DECLARE done BOOL; - DECLARE cur CURSOR FOR + DECLARE vAvailableCalc INT; + DECLARE vShipment DATE; + DECLARE vAgencyId INT; + DECLARE vWh INT; + DECLARE vDone BOOL; + DECLARE cTravelTree CURSOR FOR SELECT warehouse_id, Fecha_envio FROM travel_tree; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; -- Establecemos los almacenes y las fechas que van a entrar al disponible - SELECT agency_id INTO v_agency_id FROM Agencias WHERE Id_Agencia = v_agencia; + SELECT agency_id INTO vAgencyId + FROM Agencias WHERE Id_Agencia = vAgency; - CALL travel_tree (v_date,v_consigna, v_agency_id); + CALL travel_tree (vDate, vAddress, vAgencyId); DROP TEMPORARY TABLE IF EXISTS t_bionic_available; CREATE TEMPORARY TABLE t_bionic_available( @@ -17342,22 +17785,22 @@ BEGIN ) ENGINE = MEMORY; - OPEN cur; + OPEN cTravelTree; l: LOOP - SET done = FALSE; - FETCH cur INTO v_wh, v_shipment; + SET vDone = FALSE; + FETCH cTravelTree INTO vWh, vShipment; - IF done THEN + IF vDone THEN LEAVE l; END IF; - CALL `cache`.available_refresh (v_available_calc, FALSE, v_wh, v_shipment); + CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWh, vShipment); - INSERT IGNORE INTO t_bionic_available (calc_id) - VALUES (v_available_calc); + INSERT IGNORE INTO t_bionic_available + SET calc_id = vAvailableCalc; END LOOP; - CLOSE cur; + CLOSE cTravelTree; DROP TEMPORARY TABLE travel_tree; END ;; DELIMITER ; @@ -17441,10 +17884,10 @@ ELSE SET v_sql = sql_printf ( ' - REPLACE articlelist + REPLACE vn2008.articlelist SELECT a.Id_Article - FROM Articles a - LEFT JOIN Tipos t ON t.tipo_id = a.tipo_id + FROM vn2008.Articles a + LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id WHERE %s AND Medida BETWEEN %v AND %v; ' @@ -17456,15 +17899,15 @@ ELSE SET v_sql = sql_printf ( ' - REPLACE articlelist + REPLACE vn2008.articlelist SELECT a.Id_Article - FROM Articles a - LEFT JOIN Tipos t ON t.tipo_id = a.tipo_id + FROM vn2008.Articles a + LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN ( SELECT DISTINCT Id_Article - FROM Movimientos m - JOIN Tickets t using(Id_Ticket) - JOIN Clientes c using(Id_Cliente) + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t using(Id_Ticket) + JOIN vn2008.Clientes c using(Id_Cliente) WHERE Fecha > CURDATE() - INTERVAL 4 DAY AND Preu BETWEEN %v AND %v AND c.invoice <> 0 @@ -17479,7 +17922,7 @@ ELSE ,maxMED); end if; - CALL sql_query (v_sql); + CALL util.exec (v_sql); END IF; -- SELECT Id_Article, Article, Medida FROM Articles join articlelist using(Id_Article); @@ -17605,58 +18048,58 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `bionic_available_types_filter`(IN v_date DATE, -- fecha de recepcion de mercancia - IN v_consigna INT, - IN v_agencia INT, - IN v_filter TEXT) +CREATE DEFINER=`root`@`%` PROCEDURE `bionic_available_types_filter`( + v_date DATE, + v_consigna INT, + v_agencia INT, + v_filter TEXT) BEGIN - -- @return Table t_bionic_available_types - -- Este procedimiento devuelve una tabla t_bionic_available_types - -- que debe de ser borrar por quien la llame, y se conecta con la tabla articlelist - -- que tambien hay que eliminar - - DECLARE v_sql TEXT; - DECLARE v_list TEXT; - SET v_list = ''; +/** + * Este procedimiento devuelve una tabla t_bionic_available_types + * que debe de ser borrar por quien la llame, y se conecta con la tabla articlelist + * que tambien hay que eliminar. + * + * @param vDatefecha de recepcion de mercancia + * @table t_bionic_available_types + */ - SET v_filter = IFNULL(v_filter,' TRUE'); - - CALL bionic_available_(v_date, v_consigna, v_agencia); - -- Inroducimos los valores en una tabla temporal - DROP TEMPORARY TABLE IF EXISTS t_bionic_available_types; - - CALL check_table_existence('articlelist'); - - IF @table_exists THEN - - SET v_list = 'JOIN articlelist AL ON AL.Id_Article = a.Id_Article '; - - END IF; - - SET v_sql = sql_printf ( - ' - CREATE TEMPORARY TABLE t_bionic_available_types - SELECT a.tipo_id, Tipo, reino, count(*) as item_count - FROM `cache`.available c - JOIN Articles a ON c.item_id = a.Id_Article - JOIN Tipos t ON t.tipo_id = a.tipo_id - JOIN reinos r ON r.id = t.reino_id - JOIN t_bionic_available ba ON c.calc_id = ba.calc_id - %s - WHERE c.available > 0 - AND %s - GROUP BY a.tipo_id; - ' - , v_list - , v_filter); - - - - - CALL sql_query (v_sql); - + DECLARE v_sql TEXT; + DECLARE v_list TEXT; + SET v_list = ''; + + SET v_filter = IFNULL(v_filter,' TRUE'); + + CALL bionic_available_(v_date, v_consigna, v_agencia); + -- Inroducimos los valores en una tabla temporal + DROP TEMPORARY TABLE IF EXISTS t_bionic_available_types; + + CALL check_table_existence('articlelist'); + + IF @table_exists THEN + + SET v_list = 'JOIN vn2008.articlelist AL ON AL.Id_Article = a.Id_Article '; + + END IF; + + SET v_sql = sql_printf ( + ' + CREATE TEMPORARY TABLE t_bionic_available_types + SELECT a.tipo_id, Tipo, reino, count(*) as item_count + FROM `cache`.available c + JOIN vn2008.Articles a ON c.item_id = a.Id_Article + JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id + JOIN vn2008.reinos r ON r.id = t.reino_id + JOIN vn2008.t_bionic_available ba ON c.calc_id = ba.calc_id + %s + WHERE c.available > 0 + AND %s + GROUP BY a.tipo_id; + ' + , v_list + , v_filter); + + CALL sql_query (v_sql); - DROP TEMPORARY TABLE t_bionic_available; END ;; DELIMITER ; @@ -17675,53 +18118,55 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `bionic_calc`( - v_date DATE, -- fecha de recepcion de mercancia - v_consigna INT, - v_agencia INT) + vDate DATE, -- Fecha de recepcion de mercancia + vAddress INT, + vAgency INT) proc: BEGIN - DECLARE v_available_calc INT; - DECLARE v_shipment DATE; - DECLARE v_agency_id INT; - DECLARE v_customer INT; - DECLARE v_wh SMALLINT; - DECLARE done BOOL; - DECLARE cur CURSOR FOR - SELECT warehouse_id, Fecha_envio FROM vn2008.travel_tree; + DECLARE vAvailableCalc INT; + DECLARE vShipment DATE; + DECLARE vAgencyId INT; + DECLARE vCustomer INT; + DECLARE vWh SMALLINT; + DECLARE vDone BOOL; + DECLARE cTravelTree CURSOR FOR + SELECT warehouse_id, Fecha_envio FROM travel_tree; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DROP TEMPORARY TABLE IF EXISTS tmp.bionic_item; - DROP TEMPORARY TABLE IF EXISTS tmp.bionic_component; - DROP TEMPORARY TABLE IF EXISTS tmp.bionic_lot; - DROP TEMPORARY TABLE IF EXISTS tmp.bionic_price; + DROP TEMPORARY TABLE IF EXISTS + tmp.bionic_item, + tmp.bionic_component, + tmp.bionic_lot, + tmp.bionic_price; - -- Establecemos los almacenes y las fechas que van a entrar al dispo_multi + -- Establece los almacenes y las fechas que van a entrar al disponible - SELECT agency_id INTO v_agency_id FROM vn2008.Agencias WHERE Id_Agencia = v_agencia; - SELECT Id_Cliente INTO v_customer FROM vn2008.Consignatarios WHERE Id_Consigna = v_consigna; + SELECT agency_id INTO vAgencyId FROM Agencias WHERE Id_Agencia = vAgency; + SELECT Id_Cliente INTO vCustomer FROM Consignatarios WHERE Id_Consigna = vAddress; - CALL vn2008.travel_tree(v_date,v_consigna, v_agency_id); + CALL travel_tree(vDate, vAddress, vAgencyId); - -- creamos la tabla temporal que almacenara los lotes (antigua cache.bionic) + -- Crea la tabla temporal que almacenará los lotes CREATE TEMPORARY TABLE tmp.bionic_lot LIKE template_bionic_lot; - OPEN cur; + OPEN cTravelTree; + l: LOOP - -- Comprovamos que quedan registros en el cursor - SET done = FALSE; - FETCH cur INTO v_wh, v_shipment; - IF done THEN + SET vDone = FALSE; + FETCH cTravelTree INTO vWh, vShipment; + + IF vDone THEN LEAVE l; END IF; - CALL `cache`.available_refresh (v_available_calc, FALSE, v_wh, v_shipment); - CALL item_last_buy_ (v_wh, v_shipment); + CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWh, vShipment); + CALL item_last_buy_ (vWh, vShipment); INSERT INTO tmp.bionic_lot (warehouse_id, item_id, available, buy_id) SELECT - v_wh, + vWh, i.item_id, IFNULL(i.available, 0), ilb.buy_id @@ -17729,22 +18174,22 @@ proc: BEGIN JOIN tmp.bionic_calc br ON br.item_id = i.item_id LEFT JOIN Articles a ON a.Id_Article = i.item_id LEFT JOIN t_item_last_buy ilb ON ilb.item_id = i.item_id - WHERE i.calc_id = v_available_calc + WHERE i.calc_id = vAvailableCalc AND a.Id_Article != 100 AND i.available > 0; DROP TEMPORARY TABLE t_item_last_buy; - END LOOP; - CLOSE cur; + CLOSE cTravelTree; - CALL bionic_calc_component(v_consigna,v_agencia); + CALL bionic_calc_component(vAddress, vAgency); CREATE TEMPORARY TABLE tmp.bionic_item ENGINE = MEMORY - SELECT b.item_id, SUM(b.available) available, p.name producer, a.Article item, a.Medida size, a.Tallos stems, - a.Categoria category, a.Color, a.Foto image, o.Abreviatura origin, bl.min_price price + SELECT b.item_id, SUM(b.available) available, p.name producer, + a.Article item, a.Medida size, a.Tallos stems, a.Categoria category, + a.Color, a.Foto image, o.Abreviatura origin, bl.min_price price FROM tmp.bionic_lot b JOIN Articles a ON b.item_id = a.Id_Article LEFT JOIN producer p ON p.producer_id = a.producer_id AND p.visible @@ -17754,8 +18199,7 @@ proc: BEGIN FROM tmp.bionic_price GROUP BY item_id ) bl ON bl.item_id = b.item_id - GROUP BY b.item_id; - + GROUP BY b.item_id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -18070,8 +18514,8 @@ proc: BEGIN * ROUND( r.cm3 * IF(a.Vista = 1, (GREATEST(art.density,DENSIDAD_MINIMA_PESO_VOLUMETRICO) / DENSIDAD_MINIMA_PESO_VOLUMETRICO ) , 1) - * az.price - * az.inflacion + * IFNULL(az.price + * az.inflacion ,50) / VOLUMEN_CAJA_VERDNATURA, 4 ) cost FROM t_bionic_temp b @@ -18105,7 +18549,8 @@ proc: BEGIN JOIN vn2008.agency_weekday_bonus awb ON awb.warehouse_id = az.warehouse_id AND awb.zona = az.zona AND a.agency_id = awb.agency_id LEFT JOIN bi.rotacion r ON r.warehouse_id = b.warehouse_id AND r.Id_Article = b.item_id JOIN vn2008.travel_tree t ON t.warehouse_id = awb.warehouse_id AND weekday(t.Fecha_recepcion) = awb.weekDay - HAVING cost <> 0; + HAVING cost <> 0 + LIMIT 1; -- PAK 12-05-2015 -- EMBOLSADO @@ -19017,6 +19462,14 @@ BEGIN DROP TEMPORARY TABLE t_item_last_buy; CALL bionic_calc_component ( v_consigna, v_agencia); + + -- REPLACE INTO tmp.bionic_component (warehouse_id, item_id, component_id, cost) + -- SELECT t.warehouse_id, m.Id_Article, mc.Id_Componente, mc.Valor + -- FROM Movimientos_componentes mc + -- JOIN Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + -- JOIN Tickets t ON t.Id_Ticket = m.Id_Ticket + -- JOIN tarifa_componentes tc ON tc.Id_componente = mc.Id_Componente + -- WHERE m.Id_Ticket = v_ticket AND tc.is_renewable = FALSE; -- para recuperar el shipment en caso de que se necesite @@ -19128,6 +19581,70 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bionic_make_updateTest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `bionic_make_updateTest`( + i_ticket INT + ,i_agencia INT + ,i_consigna INT + ,i_warehouse INT + ,d_shipment DATE + ,d_landing DATE + ,i_option INT) +BEGIN +/** + * Ejecuta los cambios en el ticket, en los movimientos y en los componentes. + */ + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + -- Cambios en el ticket + + START TRANSACTION; + + UPDATE Tickets t + SET + t.Id_Agencia = i_agencia, + t.Id_Consigna = i_consigna, + t.warehouse_id = i_warehouse, + t.landing = d_landing, + t.Fecha = d_shipment + WHERE + t.Id_Ticket = i_ticket; + + -- La opcion 8 es No realizar modificaciones en los precios + + IF i_option <> 8 + THEN + DROP TEMPORARY TABLE IF EXISTS tmp.movement; + CREATE TEMPORARY TABLE tmp.movement + (PRIMARY KEY (Id_Movimiento)) + ENGINE = MEMORY + SELECT Id_Movimiento, i_warehouse warehouse_id + FROM Movimientos m WHERE m.Id_Ticket = i_ticket; + + CALL bionic_movement_updateTest(i_option); + DROP TEMPORARY TABLE tmp.movement; + END IF; + + COMMIT; +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 DROP PROCEDURE IF EXISTS `bionic_movement_update` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -19229,7 +19746,7 @@ BEGIN SET bolRESPETA_PRECIOS = TRUE; END CASE; - + IF bolRENUEVA_COMPONENTES THEN -- Eliminamos todos los componentes exceptos los propios de la tarifa para no perderla @@ -19250,7 +19767,7 @@ BEGIN WHERE IF(mc.Id_Componente IS NULL AND tc.is_renewable = FALSE,FALSE,TRUE); END IF; - + IF bolRESPETA_PRECIOS THEN REPLACE INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) @@ -19338,6 +19855,245 @@ BEGIN WHERE tp.hasComponents = FALSE; */ +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bionic_movement_updateTest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `bionic_movement_updateTest`(i_option INT) +BEGIN +/** + * A partir de la tabla tmp.movement, crea los Movimientos_componentes + * y modifica el campo Preu de la tabla Movimientos + * + * @param i_option integer tipo de actualizacion + * @param table tmp.movement tabla memory con el campo Id_Movimiento, warehouse_id + **/ + DECLARE intComponent INT; + DECLARE bolRENUEVA_COMPONENTES BOOLEAN; + DECLARE bolRESPETA_PRECIOS BOOLEAN; + + CASE i_option + + WHEN 1 THEN -- caso normal + + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = FALSE; + + WHEN 2 THEN + + SET intComponent = 17; -- greuge al client + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = TRUE; + + WHEN 3 THEN + + SET intComponent = 37; -- convertir en maná + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = TRUE; + + WHEN 4 THEN + + SET intComponent = 34; -- greuge contra la cartera del producto + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = TRUE; + + WHEN 5 THEN + + SET intComponent = 35; -- greuge contra la cartera del comprador + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = TRUE; + + WHEN 6 THEN + + SET intComponent = 36; -- descuadre para la empresa + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = TRUE; + + WHEN 7 THEN + -- Insertamos el 80% para el coste + REPLACE INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento,28, round(((m.Preu * (100 - m.Descuento) /100 ) - SUM(IFNULL(mc.Valor,0))) * 0.8 ,3) + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + LEFT JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente NOT IN (28,29) + GROUP BY m.Id_Movimiento; + + -- Insertamos el 20% para el margen + REPLACE INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento,29, round(((m.Preu * (100 - m.Descuento) /100 ) - SUM(IFNULL(mc.Valor,0))) * 0.2 ,3) + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + LEFT JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente NOT IN (28,29) + GROUP BY m.Id_Movimiento; + + SET bolRENUEVA_COMPONENTES = FALSE; + SET bolRESPETA_PRECIOS = FALSE; + + WHEN 8 THEN + -- Eliminamos todos los componentes exceptos los propios de la tarifa para no perderla + DELETE mc.* + FROM tmp.movement mo + JOIN Movimientos_componentes mc ON mo.Id_Movimiento = mc.Id_Movimiento; + + -- Insertamos el 100% para el coste Tipo 78 (Genérico) + REPLACE INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento,28, round(((m.Preu * (100 - m.Descuento) /100 )) ,3) + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento; + + SET bolRENUEVA_COMPONENTES = FALSE; + SET bolRESPETA_PRECIOS = FALSE; + + WHEN 9 THEN -- PAK 2017-02-06 caso especial de artículos cuyo precio se pone a mano, como los portes + + SET bolRENUEVA_COMPONENTES = TRUE; + SET bolRESPETA_PRECIOS = TRUE; + + END CASE; + + IF bolRENUEVA_COMPONENTES THEN + + -- Eliminamos todos los componentes exceptos los propios de la tarifa para no perderla + DELETE mc.* + FROM tmp.movement mo + JOIN Movimientos_componentes mc ON mo.Id_Movimiento = mc.Id_Movimiento + JOIN tarifa_componentes tc ON tc.Id_Componente = mc.Id_Componente + WHERE tc.is_renewable = TRUE; + SELECT m.Id_Movimiento, bc.component_id, bc.cost + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + JOIN tmp.bionic_component bc ON bc.item_id = m.Id_Article AND bc.warehouse_id = mo.warehouse_id + LEFT JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = bc.component_id + LEFT JOIN tarifa_componentes tc ON tc.Id_Componente = bc.component_id + WHERE IF(mc.Id_Componente IS NULL AND tc.is_renewable = FALSE,FALSE,TRUE); + -- Insertamos los componentes actuales + REPLACE INTO Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento, bc.component_id, bc.cost + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + JOIN tmp.bionic_component bc ON bc.item_id = m.Id_Article AND bc.warehouse_id = mo.warehouse_id + LEFT JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = bc.component_id + LEFT JOIN tarifa_componentes tc ON tc.Id_Componente = bc.component_id + WHERE IF(mc.Id_Componente IS NULL AND tc.is_renewable = FALSE,FALSE,TRUE); + + END IF; + + IF bolRESPETA_PRECIOS THEN + + REPLACE INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento,intComponent, round((m.Preu * (100 - m.Descuento) /100 ) - SUM(mc.Valor) ,3) dif + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + LEFT JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento + WHERE mc.Id_Componente <> intComponent + GROUP BY m.Id_Movimiento + HAVING dif <> 0; + + SELECT m.Id_Movimiento,intComponent, round((m.Preu * (100 - m.Descuento) /100 ) - SUM(mc.Valor) ,3) dif + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + LEFT JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento + WHERE mc.Id_Componente <> intComponent + GROUP BY m.Id_Movimiento + HAVING dif <> 0; + ELSE + + -- Cambios en movimientos. + UPDATE Movimientos m + JOIN Articles a on a.Id_Article = m.Id_Article + JOIN Tipos tp on tp.tipo_id = a.tipo_id + JOIN (SELECT SUM(mc.Valor) sum_valor,mc.Id_Movimiento + FROM Movimientos_componentes mc + JOIN tmp.movement m ON m.Id_Movimiento = mc.Id_Movimiento + GROUP BY mc.Id_Movimiento) mc ON mc.Id_Movimiento = m.Id_Movimiento + SET m.Preu = sum_valor + WHERE Tipo != 'Portes'; -- PAK 2017-02-06 + + SELECT SUM(mc.Valor) sum_valor,mc.Id_Movimiento + FROM Movimientos_componentes mc + JOIN tmp.movement m ON m.Id_Movimiento = mc.Id_Movimiento + GROUP BY mc.Id_Movimiento; + + -- Insertamos descuento, si lo hay + + REPLACE INTO Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento, 21, m.Preu * (100 -m.Descuento) / 100 - sum(Valor) v_valor + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento + WHERE mc.Id_Componente != 21 + GROUP BY m.Id_Movimiento having round(v_valor,4) <> 0; + SELECT m.Id_Movimiento, 21, m.Preu * (100 -m.Descuento) / 100 - sum(Valor) v_valor + FROM Movimientos m + JOIN tmp.movement mo ON m.Id_Movimiento = mo.Id_Movimiento + JOIN Movimientos_componentes mc ON mc.Id_Movimiento = m.Id_Movimiento + WHERE mc.Id_Componente != 21 + GROUP BY m.Id_Movimiento having round(v_valor,4) <> 0; + END IF; + + -- Fija el Costfixat + + UPDATE Movimientos m + JOIN (SELECT SUM(mc.Valor) sum_valor,mc.Id_Movimiento + FROM Movimientos_componentes mc + JOIN tmp.movement m ON m.Id_Movimiento = mc.Id_Movimiento + join bi.tarifa_componentes tc using(Id_Componente) + join bi.tarifa_componentes_series tcs on tcs.tarifa_componentes_series_id = tc.tarifa_componentes_series_id AND tcs.base + GROUP BY mc.Id_Movimiento) mc ON mc.Id_Movimiento = m.Id_Movimiento + SET m.CostFixat = sum_valor, PrecioFijado = 1; + + + -- PAK 2017-02-06 + -- Familia PORTES, un unico componente de porte + + DELETE mc.* + FROM Movimientos_componentes mc + JOIN tmp.movement mo ON mo.Id_Movimiento = mc.Id_Movimiento + JOIN Movimientos m on m.Id_Movimiento = mc.Id_Movimiento + JOIN Articles a ON a.Id_Article = m.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + WHERE Tipo = 'Portes'; + + INSERT INTO Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento, 15, preu -- Reparto + FROM Movimientos m + JOIN tmp.movement mo ON mo.Id_Movimiento = m.Id_Movimiento + JOIN Articles a ON a.Id_Article = m.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + WHERE Tipo = 'Portes' AND preu > 0; + + -- PAK 2017-09-27 + -- Tipos con un unico componente de coste + /* + DELETE mc.* + FROM Movimientos_componentes mc + JOIN tmp.movement mo ON mo.Id_Movimiento = mc.Id_Movimiento + JOIN Movimientos m on m.Id_Movimiento = mc.Id_Movimiento + JOIN Articles a ON a.Id_Article = m.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + WHERE tp.hasComponents = FALSE; + + INSERT INTO Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento, 28, preu -- Coste + FROM Movimientos m + JOIN tmp.movement mo ON mo.Id_Movimiento = m.Id_Movimiento + JOIN Articles a ON a.Id_Article = m.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + WHERE tp.hasComponents = FALSE; +*/ + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -19646,9 +20402,148 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `buy_label_bunch`(IN entry_id_ INT, IN groupby TINYINT(1),IN single TINYINT(1), IN idCOM BIGINT) +BEGIN + DECLARE done INT DEFAULT 0; + DECLARE date_ DATE; + DECLARE provider_id INT; + DECLARE agency_id INT; + DECLARE i_wh INT; + DECLARE label INT; + DECLARE id INT; + DECLARE recordset CURSOR FOR + SELECT ROUND(C.Cantidad / IF(C.caja = FALSE, 1,C.Grouping) + 0.49), C.Id_Compra + FROM Compres C + INNER JOIN entry_label ON C.Id_Entrada = entry_label.entry_id + INNER JOIN Articles A ON C.Id_Article = A.Id_Article + WHERE (A.Imprimir <> FALSE AND idCOM = 0 AND C.Novincular = FALSE) + OR idCOM = C.Id_Compra; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + SET idCOM = IFNULL(idCOM, 0); + + DROP TEMPORARY TABLE IF EXISTS `entry_label`; + CREATE TEMPORARY TABLE `entry_label` + (`entry_id` INT(11) NOT NULL) + ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + IF groupby <> FALSE THEN + + SELECT Id_Proveedor, DATE(landing), travel.agency_id, warehouse_id + INTO provider_id, date_, agency_id, i_wh + FROM Entradas + INNER JOIN travel ON travel.id = Entradas.travel_id + WHERE Id_Entrada = entry_id_; + + INSERT INTO entry_label (entry_id) + SELECT Entradas.Id_Entrada + FROM Entradas + INNER JOIN travel ON travel.id = Entradas.travel_id + WHERE Entradas.Inventario = FALSE + AND Entradas.Id_Proveedor = provider_id + AND warehouse_id = i_wh + AND DATE(landing) = date_ + AND travel.agency_id= agency_id; + + ELSE + + INSERT INTO entry_label (entry_id) VALUES (entry_id_); + SELECT landing + INTO date_ FROM + Entradas e + JOIN travel t ON t.id = e.travel_id + JOIN Compres c ON c.Id_Entrada = e.Id_Entrada + WHERE (entry_id_ = e.Id_Entrada + OR c.Id_Compra = idCOM) + LIMIT 1; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS `buy_label_source`; + + CREATE TEMPORARY TABLE `buy_label_source` + (`buy_id` INT(11) NOT NULL) + ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + OPEN recordset; + FETCH recordset INTO label, id; + REPEAT + REPEAT + SET label = label - 1; + INSERT INTO buy_label_source (buy_id) VALUES (id); + UNTIL label <= 0 OR single END REPEAT; + + INSERT INTO buy_label_source (buy_id) VALUES (0); + FETCH recordset INTO label, id; + UNTIL done END REPEAT; + + SELECT + C.Id_Article, + @a:=IF(A.min + AND IFNULL(rate_3, C.Tarifa3) < A.PVP, + A.PVP, + IFNULL(rate_3, C.Tarifa3)) Tarifa2, + ROUND(IF(C.caja = FALSE, @a, @a * C.Grouping), + 2) AS Bunch, + ROUND(@a / A.Tallos, 2) AS PPT, + A.Article, + A.Medida, + A.Color, + A.Categoria, + Abreviatura AS Origen, + p.name Productor, + A.Tallos, + C.grouping, + E.Notas_Eva, + P.Proveedor, + C.Packing + FROM + buy_label_source bls + LEFT JOIN + Compres C ON C.Id_Compra = bls.buy_id + LEFT JOIN + Entradas E ON E.Id_Entrada = C.Id_Entrada + LEFT JOIN + Articles A ON A.Id_Article = C.Id_Article + LEFT JOIN + Proveedores P ON P.Id_Proveedor = E.Id_Proveedor + LEFT JOIN + Origen o ON A.id_origen = o.id + LEFT JOIN + producer p ON p.producer_id = A.producer_id + LEFT JOIN + (SELECT + item_id, rate_3 + FROM + price_fixed + WHERE + IFNULL(date_, CURDATE()) BETWEEN date_start AND date_end + AND rate_3 + AND warehouse_id IN (0 , i_wh) + GROUP BY item_id) pf ON pf.item_id = A.Id_Article; + + DROP TEMPORARY TABLE `entry_label`; + DROP TEMPORARY TABLE `buy_label_source`; + +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 DROP PROCEDURE IF EXISTS `buy_label_bunchkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `buy_label_bunchkk`(IN entry_id_ INT, IN groupby TINYINT(1),IN single TINYINT(1), IN idCOM BIGINT) BEGIN DECLARE done INT DEFAULT 0; DECLARE date_ DATE; @@ -20002,11 +20897,11 @@ BEGIN JOIN tblTARIFAS TC SET C.Portefijo = @PF:= IF (va.importe, - ROUND((va.importe * TP.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), + ROUND((va.importe * A.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), ROUND(IFNULL(((AG.m3 * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) / C.Packing,0),3) ), C.Comisionfija = @CF:= ROUND(IFNULL(E.comision * C.Costefijo / 100,0),3), - C.Embalajefijo = @EF:= IF(CB.Retornable != 0, 0, ROUND(IFNULL( CB.Valor / C.Packing ,0),3)), + C.Embalajefijo = @EF:= ROUND((CB.costeRetorno + IF(CB.Retornable != 0, 0, CB.Valor)) / C.packing,3), C.Tarifa3 = @t3:= IF(TC.t3 = 0, C.Costefijo,ROUND((C.Costefijo + @CF + @EF + @PF) / ((100 - TC.t3 - TP.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 C.Tarifa2 = @t2:= ROUND(@t3 * (1 + ( (TC.t2 - TC.t3)/100) ),2), C.Tarifa2 = IF(@t2 <= @t3, @t3 , @t2) @@ -20065,13 +20960,13 @@ LIMIT 1; JOIN Agencias AG ON TR.agency_id = AG.Id_Agencia JOIN tblTARIFAS TC - SET C.Portefijo = @PF:= round((va.importe * TP.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), + SET C.Portefijo = @PF:= round((va.importe * A.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), C.Comisionfija = @CF:= ROUND(IFNULL(E.comision * C.Costefijo / 100,0),3), - C.Embalajefijo = @EF:= IF(CB.Retornable != 0, 0, ROUND(IFNULL( CB.Valor / C.Packing ,0),3)), - - C.Tarifa3 = @t3:= IF(TC.t3 = 0, C.Costefijo,ROUND((C.Costefijo + @CF + @EF + @PF) / ((100 - TC.t3 - TP.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 + C.Embalajefijo = @EF:= ROUND((CB.costeRetorno + IF(CB.Retornable != 0, 0, CB.Valor)) / C.Packing,3), + + C.Tarifa3 = @t3:= IF(TC.t3 = 0, C.Costefijo,ROUND((C.Costefijo + @CF + @EF + @PF) / ((100 - TC.t3 - TP.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 C.Tarifa2 = @t2:= round(@t3 * (1 + ( (TC.t2 - TC.t3)/100) ),2), @@ -20178,7 +21073,7 @@ BEGIN CALL buy_tarifas_table(idENTRADA); SELECT AG.m3 * sum( etiquetas * IFNULL(((AG.m3 * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) ,0) ) / - sum(etiquetas * IFNULL(((AG.m3 * ( TP.density / 167 ) * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) ,0)) INTO m3i + sum(etiquetas * IFNULL(((AG.m3 * ( A.density / 167 ) * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) ,0)) INTO m3i FROM Compres C JOIN Articles A USING(Id_Article) JOIN Entradas E USING(Id_Entrada) @@ -20204,14 +21099,11 @@ BEGIN SET C.Portefijo = @PF:= IF (va.importe, - round((va.importe * TP.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), + round((va.importe * A.density * CM3_2(C.Id_Cubo, C.Id_Article) / 1000) / (va.Vol_Total * 167 * C.Packing ),3), ROUND(IFNULL(((AG.m3 * @cm3:= cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) / C.Packing,0),3) ), - -- jgf 2015-08-14 canvie este procediment per a que coincidisca en el buy_tarifas - -- ROUND(IFNULL(((m3i * @cm3:= ( TP.density / 167 ) * cm3_2(C.Id_Cubo, C.Id_Article)) / 1000000) / C.Packing,0),3), - C.Comisionfija = @CF:= ROUND(IFNULL(E.comision * C.Costefijo / 100,0),3), C.Embalajefijo = @EF:= IF(CB.Retornable != 0, 0, ROUND(IFNULL( CB.Valor / C.Packing ,0),3)), @@ -20657,6 +21549,30 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `cacheReset` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `cacheReset`(vCacheName VARCHAR(10), vParams VARCHAR(15)) +BEGIN + + UPDATE cache.cache_calc + SET expires = NOW() + WHERE cacheName = vCacheName collate utf8_unicode_ci + AND params = vParams collate utf8_unicode_ci; + +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 DROP PROCEDURE IF EXISTS `Cajas_Saldo_Detalle` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -20734,6 +21650,81 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `CalculoRemesas`(IN vFechaRemesa DATE) BEGIN + DROP TEMPORARY TABLE IF EXISTS TMP_REMESAS; + CREATE TEMPORARY TABLE TMP_REMESAS SELECT + CONCAT(p.NIF,REPEAT('0', 12-LENGTH(p.NIF))) as CIF1, + cli.Id_Cliente, + cli.Cliente, + cli.`IF` as NIF, + c.PaymentDate as Vencimiento, + 0 ImporteFac, + cast(c.Recibo as decimal(10,2)) as ImporteRec, + 0 as ImporteActual, + c.company_id empresa_id, + cli.RazonSocial, + cast(c.Recibo as decimal(10,2)) as ImporteTotal, + cast(c.Recibo as decimal(10,2)) as Saldo, + p.Proveedor as Empresa, + e.abbreviation as EMP, + cli.cuenta, + iban AS Iban, + CONVERT(SUBSTRING(iban,5,4),UNSIGNED INT) AS nrbe , + sepavnl as SEPA, + corevnl as RecibidoCORE + + FROM Clientes cli + JOIN + (SELECT risk.company_id, + c.Id_Cliente, + sum(risk.amount) as Recibo, + IF((c.Vencimiento + graceDays) mod 30.001 <= day(vFechaRemesa) + ,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-1,vFechaRemesa))) + ,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-2,vFechaRemesa))) + ) as PaymentDate + FROM Clientes c + JOIN pay_met pm on pm.id = pay_met_id + JOIN + ( + SELECT company_id, customer_id, amount + FROM Clientes c + JOIN bi.customer_risk cr ON cr.customer_id = c.Id_Cliente + WHERE pay_met_id = 4 + + UNION ALL + + SELECT empresa_id, Id_Cliente, - Importe + FROM Facturas f + JOIN Clientes c using(Id_Cliente) + JOIN pay_met pm on pm.id = pay_met_id + WHERE f.Vencimiento > vFechaRemesa + AND pay_met_id = 4 AND deudaviva + AND Importe > 0 + + ) risk ON c.Id_Cliente = risk.customer_id + GROUP BY risk.company_id, Id_Cliente + HAVING Recibo > 10 + ) c on c.Id_Cliente = cli.Id_Cliente + JOIN Proveedores p on p.Id_Proveedor = c.company_id + JOIN empresa e on e.id = c.company_id; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `CalculoRemesaskk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `CalculoRemesaskk`(IN vFechaRemesa DATE) +BEGIN + DROP TEMPORARY TABLE IF EXISTS TMP_REMESAS; CREATE TEMPORARY TABLE TMP_REMESAS SELECT @@ -20813,8 +21804,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `calling`() BEGIN - -DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2; + DROP TEMPORARY TABLE IF EXISTS Agenda, Agenda2; CREATE TEMPORARY TABLE IF NOT EXISTS Agenda (Telefono varchar(15) PRIMARY KEY, Cliente VARCHAR(45)); @@ -20851,23 +21841,25 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `camiones`(vWarehouse INT, vDate DATE) -BEGIN - SELECT Temperatura - ,ROUND(SUM(Etiquetas * cm3_2(Id_Cubo, Id_Article))) AS cm3 - ,ROUND(SUM(IF(scanned,Etiquetas,0) * cm3_2(Id_Cubo, Id_Article))) AS cm3s - ,ROUND(SUM(Vida * cm3_2(Id_Cubo, Id_Article))) AS cm3e - FROM ( - SELECT t.Temperatura, c.Etiquetas, c.Id_Cubo, c.Id_Article, b.scanned, c.Vida - FROM Compres c - LEFT JOIN buy_edi b ON b.id = c.buy_edi_id - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Tipos t ON t.tipo_id = a.tipo_id - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel tr ON tr.id = e.travel_id - WHERE tr.warehouse_id = vWarehouse - AND tr.landing = vDate - ) sub - GROUP BY Temperatura; +BEGIN + SELECT Temperatura + ,ROUND(SUM(Etiquetas * volume)) AS cm3 + ,ROUND(SUM(IF(scanned, Etiquetas, 0) * volume)) AS cm3s + ,ROUND(SUM(Vida * volume)) AS cm3e + FROM ( + SELECT t.Temperatura, c.Etiquetas, b.scanned, c.Vida, + IF(cu.Volumen > 0, cu.Volumen, cu.x * cu.y * IF(cu.z > 0, cu.z, a.Medida + 10)) volume + FROM Compres c + LEFT JOIN buy_edi b ON b.id = c.buy_edi_id + JOIN Articles a ON a.Id_Article = c.Id_Article + JOIN Tipos t ON t.tipo_id = a.tipo_id + JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada + JOIN travel tr ON tr.id = e.travel_id + JOIN Cubos cu ON cu.Id_Cubo = c.Id_Cubo + WHERE tr.warehouse_id = vWarehouse + AND tr.landing = vDate + ) sub + GROUP BY Temperatura; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -20972,15 +21964,15 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `check_table_existence`(IN table_name CHAR(64)) BEGIN DECLARE CONTINUE HANDLER FOR SQLSTATE '42S02' SET @err = 1; SET @err = 0; SET @table_name = table_name; - SET @sql_query = CONCAT('SELECT NULL FROM ',@table_name); - PREPARE stmt1 FROM @sql_query; + SET @sqlString = CONCAT('SELECT NULL FROM ',@table_name); + PREPARE stmt1 FROM @sqlString; IF (@err = 1) THEN SET @table_exists = 0; ELSE @@ -21005,45 +21997,39 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean`(IN v_full TINYINT(1)) BEGIN - DECLARE v_date DATETIME; + DECLARE v_date DATETIME; DECLARE v_date_fut DATE; DECLARE v_date18 DATETIME; - DECLARE v_date8 DATE; - DECLARE v_date6 DATE; - DECLARE strtable varchar(15) DEFAULT NULL; + DECLARE v_date8 DATE; + DECLARE v_date6 DATE; + DECLARE v_date3Month DATE; + DECLARE strtable varchar(15) DEFAULT NULL; DECLARE done BIT DEFAULT 0; - /* - DECLARE cursor_table CURSOR FOR SELECT TABLE_NAME - FROM information_schema.TABLES - WHERE TABLE_NAME LIKE 'b20%' - AND TABLE_SCHEMA = 'vn2008'; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - DECLARE CONTINUE HANDLER FOR 1051 SET done = 0; -*/ - SET v_date = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET v_date18 = TIMESTAMPADD(MONTH, -18,CURDATE()); - SET v_date8 = TIMESTAMPADD(DAY, -8,CURDATE()); - SET v_date6 = TIMESTAMPADD(DAY, -6,CURDATE()); - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('clean START'); - -- - DELETE FROM cdr WHERE calldate < v_date; - DELETE FROM Monitoring WHERE ODBC_TIME < v_date; - DELETE FROM Conteo WHERE Fecha < v_date; - DELETE FROM XDiario WHERE FECHA < v_date OR FECHA IS NULL; + SET v_date = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET v_date18 = TIMESTAMPADD(MONTH, -18,CURDATE()); + SET v_date3Month = TIMESTAMPADD(MONTH, -3, CURDATE()); + SET v_date8 = TIMESTAMPADD(DAY, -8,CURDATE()); + SET v_date6 = TIMESTAMPADD(DAY, -6,CURDATE()); + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('clean START'); + + DELETE FROM cdr WHERE calldate < v_date; + DELETE FROM Monitoring WHERE ODBC_TIME < v_date; + DELETE FROM Conteo WHERE Fecha < v_date; + DELETE FROM XDiario WHERE FECHA < v_date3Month OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < v_date; - - -- + -- DELETE FROM Cajas WHERE CajaFecha < v_date18; + DELETE rr FROM Recibos_recorded rr JOIN Recibos r ON rr.Id_Recibos = r.Id WHERE r.Fechacobro < v_date; - - SELECT MAX(idTickets_dits) + + SELECT MAX(idTickets_dits) INTO @id FROM Tickets_dits WHERE ODBC_DATE < v_date; - DELETE FROM Tickets_dits WHERE idTickets_dits <= @id; - + DELETE FROM Tickets_dits WHERE idTickets_dits <= @id; + -- DELETE FROM Tickets_dits WHERE ODBC_DATE < v_date; DELETE FROM expeditions WHERE odbc_date < v_date18; DELETE FROM expeditions_deleted WHERE odbc_date < v_date18; @@ -21062,105 +22048,89 @@ BEGIN DELETE FROM sharingcart where datEND < v_date; DELETE FROM sharingclient where datEND < v_date; DELETE FROM Stockcontrol WHERE Datestart < v_date18; - DELETE FROM bi.comparativa_clientes WHERE Fecha < v_date18; - DELETE FROM reference_rate WHERE date < v_date18; - - SELECT MAX(inter_id) + DELETE FROM bi.comparativa_clientes WHERE Fecha < v_date18; + DELETE FROM reference_rate WHERE date < v_date18; + + SELECT MAX(inter_id) INTO @id - FROM vncontrol.inter - WHERE odbc_date < v_date18; - DELETE FROM vncontrol.inter WHERE inter_id <= @id; - - -- DELETE FROM vncontrol.inter WHERE odbc_date < v_date18; + FROM vncontrol.inter + WHERE odbc_date < v_date18; + DELETE FROM vncontrol.inter WHERE inter_id <= @id; + + -- DELETE FROM vncontrol.inter WHERE odbc_date < v_date18; DELETE FROM Entradas_dits WHERE ODBC_DATE < v_date; - DELETE FROM Ordenes WHERE datTICKET < v_date18 AND datTICKET <> '2000-01-01'; - DELETE FROM cyc_declaration WHERE Fecha < v_date18; - DELETE FROM vn.message WHERE sendDate < v_date; - DELETE FROM travel_reserve WHERE odbc_date < v_date; - -- DELETE FROM syslog.systemevents WHERE odbc_date < v_date8; - DELETE FROM daily_task_log WHERE odbc_date < v_date; - DELETE FROM bi.Greuge_Evolution WHERE Fecha < v_date AND weekday(Fecha) != 1; - DELETE mc FROM Movimientos_checked mc JOIN Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento WHERE m.odbc_date < v_date; - DELETE FROM cache.departure_limit WHERE Fecha < TIMESTAMPADD(MONTH,-1,CURDATE()); - DELETE cm FROM Compres_mark cm + DELETE FROM Ordenes WHERE datTICKET < v_date18 AND datTICKET <> '2000-01-01'; + DELETE FROM cyc_declaration WHERE Fecha < v_date18; + DELETE FROM vn.message WHERE sendDate < v_date; + DELETE FROM travel_reserve WHERE odbc_date < v_date; + -- DELETE FROM syslog.systemevents WHERE odbc_date < v_date8; + DELETE FROM daily_task_log WHERE odbc_date < v_date; + -- DELETE FROM bi.Greuge_Evolution WHERE Fecha < v_date AND weekday(Fecha) != 1; + DELETE mc FROM Movimientos_checked mc JOIN Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento WHERE m.odbc_date < v_date; + DELETE FROM cache.departure_limit WHERE Fecha < TIMESTAMPADD(MONTH,-1,CURDATE()); + DELETE cm + FROM Compres_mark cm JOIN Compres c ON c.Id_Compra = cm.Id_Compra JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada JOIN travel t ON t.id = e.travel_id WHERE t.landing <= v_date; - 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 <= v_date; - -- - DELETE FROM vn2008.scan WHERE odbc_date < v_date6 AND id <> 1; - - SET v_date = TIMESTAMPADD(YEAR, 2000 - YEAR(v_date), v_date); + 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 <= v_date; + -- + DELETE FROM vn2008.scan WHERE odbc_date < v_date6 AND id <> 1; + + SET v_date = TIMESTAMPADD(YEAR, 2000 - YEAR(v_date), v_date); SET v_date_fut = TIMESTAMPADD(MONTH, 3, v_date); + IF v_date_fut > '2000-12-31' THEN SET v_date_fut = '2000-12-30'; END IF; - IF v_full THEN - - DELETE FROM Tickets - WHERE (Fecha <= v_date AND Fecha NOT IN ('2000-01-01','2000-01-02')) + IF v_full + THEN + DELETE FROM Tickets + WHERE (Fecha <= v_date AND Fecha NOT IN ('2000-01-01','2000-01-02')) OR (Fecha BETWEEN v_date_fut AND '2000-12-31'); - DELETE e.* FROM Entradas e - LEFT JOIN recibida_entrada re ON e.Id_Entrada = re.Id_Entrada - WHERE travel_id IS NULL - AND re.Id_Entrada IS NULL; + DELETE e.* FROM Entradas e + LEFT JOIN recibida_entrada re ON e.Id_Entrada = re.Id_Entrada + WHERE travel_id IS NULL + AND re.Id_Entrada IS NULL; + END IF; - END IF; - /* - OPEN cursor_table; - FETCH cursor_table INTO strtable; - REPEAT - IF NOT done THEN - CALL vn2008.sql_query (sql_printf ( - 'DROP TABLE IF EXISTS %t' - ,strtable - )); - END IF; - FETCH cursor_table INTO strtable; - UNTIL done - END REPEAT; - - CLOSE cursor_table; - */ - - -- Tickets vacios PAK 17/05/2016 - -UPDATE Tickets t -JOIN -( -SELECT DISTINCT t.Id_Ticket -FROM Tickets t -LEFT JOIN Movimientos m using(Id_Ticket) -WHERE Id_Movimiento IS NULL -AND t.Fecha between '2016-01-01' and util.yesterday()) sub using(Id_Ticket) -SET t.Fecha = TIMESTAMPADD(YEAR, 2000 - year(CURDATE()), t.Fecha); - - - -- Tickets Nulos PAK 11/10/2016 - - - UPDATE vn2008.Tickets + -- Tickets vacios PAK 17/05/2016 +/* + UPDATE Tickets t + JOIN ( + SELECT DISTINCT t.Id_Ticket + FROM Tickets t + LEFT JOIN Movimientos m using(Id_Ticket) + WHERE Id_Movimiento IS NULL + AND t.Fecha between '2016-01-01' and util.yesterday()) sub using(Id_Ticket) + SET t.Fecha = TIMESTAMPADD(YEAR, 2000 - year(CURDATE()), t.Fecha + ); +*/ + -- Tickets Nulos PAK 11/10/2016 + + UPDATE vn2008.Tickets SET empresa_id = 965 WHERE Id_Cliente = 31 - AND empresa_id != 965; - + AND empresa_id != 965; + -- Equipos duplicados - DELETE w.* - FROM vn2008.workerTeam w - JOIN (SELECT id, team, user, COUNT(*) - 1 as duplicated - FROM vn.workerTeam - GROUP BY team,user - HAVING duplicated - ) d ON d.team = w.team AND d.user = w.user AND d.id != w.id; - -INSERT INTO vn2008.daily_task_log(consulta) VALUES('clean END'); + DELETE w.* + FROM vn2008.workerTeam w + JOIN (SELECT id, team, user, COUNT(*) - 1 as duplicated + FROM vn.workerTeam + GROUP BY team,user + HAVING duplicated + ) d ON d.team = w.team AND d.user = w.user AND d.id != w.id; + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('clean END'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -21181,10 +22151,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `clean_launcher`() BEGIN call vn2008.clean(TRUE); - call vn.clean(); - call vncontrol.clean(); - call bi.clean(); - call cache.clean(); + END ;; DELIMITER ; @@ -22270,7 +23237,7 @@ BEGIN INSERT INTO article_inventory (article_id) SELECT Id_Article FROM Articles a JOIN Tipos t ON a.tipo_id = t.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = t.reino_id + LEFT JOIN reinos r ON r.id = t.reino_id WHERE (i_tipo = 0 OR a.tipo_id = i_tipo) AND r.display <> 0; @@ -22404,43 +23371,41 @@ BEGIN SET strFILTRO = REPLACE(strFILTRO, 'Id_Article','A.Id_Article'); SET strFILTRO = REPLACE(strFILTRO, 'tipo_id','tp.tipo_id'); -- select * from article_inventory; - CALL sql_query (sql_printf + CALL util.exec (sql_printf ( - 'CREATE TEMPORARY TABLE remcom + 'CREATE TEMPORARY TABLE vn2008.remcom SELECT + an.nicho, p.name Productor, C.Packing, C.Costefijo + ,A.Color, Id_Tipo as Tipo,A.tipo_id, o.Abreviatura as Origen, A.Categoria + ,A.Tallos, A.Medida, A.Article, TR.CodigoTrabajador - an.nicho, p.name Productor, C.Packing, C.Costefijo - ,A.Color, Id_Tipo as Tipo,A.tipo_id, o.Abreviatura as Origen, A.Categoria - ,A.Tallos, A.Medida, A.Article, TR.CodigoTrabajador + ,cweek1, cweek2, cweek3, cweek4, cweek5, cweek6, cweek7 + ,lweek1, lweek2, lweek3, lweek4, lweek5, lweek6, lweek7 - ,cweek1, cweek2, cweek3, cweek4, cweek5, cweek6, cweek7 - ,lweek1, lweek2, lweek3, lweek4, lweek5, lweek6, lweek7 + ,cprice1, cprice2, cprice3, cprice4, cprice5, cprice6, cprice7 + ,lprice1, lprice2, lprice3, lprice4, lprice5, lprice6, lprice7 - ,cprice1, cprice2, cprice3, cprice4, cprice5, cprice6, cprice7 - ,lprice1, lprice2, lprice3, lprice4, lprice5, lprice6, lprice7 - - ,A.Id_Article, i.buy_id , tp.life , CAST(IFNULL(i.sd,0) AS SIGNED) as sd - ,CAST(i.avalaible AS SIGNED) avalaible, CAST(i.visible AS SIGNED) visible, i.buy_date - ,E.Id_Proveedor AS provider_id, t.Orden, t.Tinta - ,A.offer, A.bargain, A.comments, A.relevancy - ,IF(cy.Id_Article IS NULL AND i.visible = 0 AND i.avalaible = 0 AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) AS filtret - - FROM article_inventory i - JOIN Articles A ON A.Id_Article = i.article_id - LEFT JOIN Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s - LEFT JOIN producer p ON p.producer_id = A.producer_id - LEFT JOIN Tipos tp ON A.tipo_id = tp.tipo_id + ,A.Id_Article, i.buy_id , tp.life , CAST(IFNULL(i.sd,0) AS SIGNED) as sd + ,CAST(i.avalaible AS SIGNED) avalaible, CAST(i.visible AS SIGNED) visible, i.buy_date + ,E.Id_Proveedor AS provider_id, t.Orden, t.Tinta + ,A.offer, A.bargain, A.comments, A.relevancy + ,IF(cy.Id_Article IS NULL AND i.visible = 0 AND i.avalaible = 0 AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) AS filtret + FROM vn2008.article_inventory i + JOIN vn2008.Articles A ON A.Id_Article = i.article_id + LEFT JOIN vn2008.Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s + LEFT JOIN vn2008.producer p ON p.producer_id = A.producer_id + LEFT JOIN vn2008.Tipos tp ON A.tipo_id = tp.tipo_id LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - LEFT JOIN Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador - LEFT JOIN Tintas t ON t.Id_Tinta = A.color - LEFT JOIN Compres C ON i.buy_id = C.Id_Compra - LEFT JOIN Entradas E USING(Id_Entrada) - LEFT JOIN Origen o ON o.id = A.id_origen - LEFT JOIN last_year ly ON ly.Id_Article = A.Id_Article - LEFT JOIN cur_year cy ON cy.Id_Article = A.Id_Article AND (i.avalaible <> 0 OR i.visible <> 0 OR cweek1 OR cweek2 OR cweek3 OR cweek4 - OR cweek5 OR cweek6 OR cweek7 OR lweek1 OR lweek2 OR lweek3 OR lweek4 OR lweek5 - OR lweek6 OR lweek7) - WHERE r.display <> 0 AND %s ' + LEFT JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador + LEFT JOIN vn2008.Tintas t ON t.Id_Tinta = A.color + LEFT JOIN vn2008.Compres C ON i.buy_id = C.Id_Compra + LEFT JOIN vn2008.Entradas E USING(Id_Entrada) + LEFT JOIN vn2008.Origen o ON o.id = A.id_origen + LEFT JOIN vn2008.last_year ly ON ly.Id_Article = A.Id_Article + LEFT JOIN vn2008.cur_year cy ON cy.Id_Article = A.Id_Article AND (i.avalaible <> 0 OR i.visible <> 0 OR cweek1 OR cweek2 OR cweek3 OR cweek4 + OR cweek5 OR cweek6 OR cweek7 OR lweek1 OR lweek2 OR lweek3 OR lweek4 OR lweek5 + OR lweek6 OR lweek7) + WHERE r.display <> 0 AND %s ' ,i_wh,strFILTRO )); @@ -22465,14 +23430,14 @@ BEGIN DROP TEMPORARY TABLE last_year; DROP TEMPORARY TABLE cur_year; - -- DROP TEMPORARY TABLE article_inventory; + DROP TEMPORARY TABLE article_inventory; 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 DROP PROCEDURE IF EXISTS `comparative2` */; +/*!50003 DROP PROCEDURE IF EXISTS `comparativekk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -22482,7 +23447,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparative2`( +CREATE DEFINER=`root`@`%` PROCEDURE `comparativekk`( v_date DATETIME ,days TINYINT ,i_wh TINYINT @@ -22663,9 +23628,9 @@ BEGIN SET strFILTRO = REPLACE(strFILTRO, 'Id_Article','A.Id_Article'); SET strFILTRO = REPLACE(strFILTRO, 'tipo_id','tp.tipo_id'); -- select * from article_inventory; - CALL sql_query (sql_printf + CALL util.exec (sql_printf ( - 'CREATE TEMPORARY TABLE remcom + 'CREATE TEMPORARY TABLE vn2008.remcom SELECT an.nicho, p.name Productor, C.Packing, C.Costefijo @@ -22684,19 +23649,19 @@ BEGIN ,A.offer, A.bargain, A.comments ,IF(cy.Id_Article IS NULL AND i.visible = 0 AND i.avalaible = 0 AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) AS filtret - FROM article_inventory i - JOIN Articles A ON A.Id_Article = i.article_id - LEFT JOIN Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s - LEFT JOIN producer p ON p.producer_id = A.producer_id - LEFT JOIN Tipos tp ON A.tipo_id = tp.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - LEFT JOIN Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador - LEFT JOIN Tintas t ON t.Id_Tinta = A.color - LEFT JOIN Compres C ON i.buy_id = C.Id_Compra - LEFT JOIN Entradas E USING(Id_Entrada) - LEFT JOIN Origen o ON o.id = A.id_origen - LEFT JOIN last_year ly ON ly.Id_Article = A.Id_Article - LEFT JOIN cur_year cy ON cy.Id_Article = A.Id_Article + FROM vn2008.article_inventory i + JOIN vn2008.Articles A ON A.Id_Article = i.article_id + LEFT JOIN vn2008.Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s + LEFT JOIN vn2008.producer p ON p.producer_id = A.producer_id + LEFT JOIN vn2008.Tipos tp ON A.tipo_id = tp.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + LEFT JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador + LEFT JOIN vn2008.Tintas t ON t.Id_Tinta = A.color + LEFT JOIN vn2008.Compres C ON i.buy_id = C.Id_Compra + LEFT JOIN vn2008.Entradas E USING(Id_Entrada) + LEFT JOIN vn2008.Origen o ON o.id = A.id_origen + LEFT JOIN vn2008.last_year ly ON ly.Id_Article = A.Id_Article + LEFT JOIN vn2008.cur_year cy ON cy.Id_Article = A.Id_Article WHERE r.display <> 0 AND (i.avalaible <> 0 OR i.visible <> 0 OR cweek1 OR cweek2 OR cweek3 OR cweek4 OR cweek5 OR cweek6 OR cweek7 OR lweek1 OR lweek2 OR lweek3 OR lweek4 OR lweek5 OR lweek6 OR lweek7) @@ -22732,7 +23697,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `comparative_test` */; +/*!50003 DROP PROCEDURE IF EXISTS `comparativekk2` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -22742,7 +23707,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparative_test`( +CREATE DEFINER=`root`@`%` PROCEDURE `comparativekk2`( v_date DATETIME ,days TINYINT ,i_wh TINYINT @@ -22923,9 +23888,9 @@ BEGIN SET strFILTRO = REPLACE(strFILTRO, 'Id_Article','A.Id_Article'); SET strFILTRO = REPLACE(strFILTRO, 'tipo_id','tp.tipo_id'); -- select * from article_inventory; - CALL sql_query (sql_printf + CALL util.exec (sql_printf ( - 'CREATE TEMPORARY TABLE remcom + 'CREATE TEMPORARY TABLE vn2008.remcom SELECT an.nicho, p.name Productor, C.Packing, C.Costefijo @@ -22944,19 +23909,19 @@ BEGIN ,A.offer, A.bargain, A.comments, A.relevancy ,IF(cy.Id_Article IS NULL AND i.visible = 0 AND i.avalaible = 0 AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) AS filtret - FROM article_inventory i - JOIN Articles A ON A.Id_Article = i.article_id - LEFT JOIN Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s - LEFT JOIN producer p ON p.producer_id = A.producer_id - LEFT JOIN Tipos tp ON A.tipo_id = tp.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - LEFT JOIN Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador - LEFT JOIN Tintas t ON t.Id_Tinta = A.color - LEFT JOIN Compres C ON i.buy_id = C.Id_Compra - LEFT JOIN Entradas E USING(Id_Entrada) - LEFT JOIN Origen o ON o.id = A.id_origen - LEFT JOIN last_year ly ON ly.Id_Article = A.Id_Article - LEFT JOIN cur_year cy ON cy.Id_Article = A.Id_Article AND (i.avalaible <> 0 OR i.visible <> 0 OR cweek1 OR cweek2 OR cweek3 OR cweek4 + FROM vn2008.article_inventory i + JOIN vn2008.Articles A ON A.Id_Article = i.article_id + LEFT JOIN vn2008.Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s + LEFT JOIN vn2008.producer p ON p.producer_id = A.producer_id + LEFT JOIN vn2008.Tipos tp ON A.tipo_id = tp.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + LEFT JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador + LEFT JOIN vn2008.Tintas t ON t.Id_Tinta = A.color + LEFT JOIN vn2008.Compres C ON i.buy_id = C.Id_Compra + LEFT JOIN vn2008.Entradas E USING(Id_Entrada) + LEFT JOIN vn2008.Origen o ON o.id = A.id_origen + LEFT JOIN vn2008.last_year ly ON ly.Id_Article = A.Id_Article + LEFT JOIN vn2008.cur_year cy ON cy.Id_Article = A.Id_Article AND (i.avalaible <> 0 OR i.visible <> 0 OR cweek1 OR cweek2 OR cweek3 OR cweek4 OR cweek5 OR cweek6 OR cweek7 OR lweek1 OR lweek2 OR lweek3 OR lweek4 OR lweek5 OR lweek6 OR lweek7) WHERE r.display <> 0 AND %s ' @@ -22991,6 +23956,246 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `comparativeTest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `comparativeTest`( + v_date DATETIME + ,days TINYINT + ,i_wh TINYINT + ,i_tipo INT + ,i_filtro INT +) +BEGIN + DECLARE wstart INT; + DECLARE wend INT; + DECLARE cyear INT; + DECLARE date_cyear_ini DATETIME; + DECLARE date_cyear_end DATETIME; + DECLARE week_count TINYINT DEFAULT 7; + DECLARE date_lyear_ini DATETIME; + DECLARE date_lyear_end DATETIME; + DECLARE corrector INT; + DECLARE w1, w2, w3, w4, w5, w6, w7 INT; + DECLARE y1, y2, y3, y4, y5, y6, y7 INT; + DECLARE wperiod INT;-- DECLARE ws, ys INT; -- PAK 11/01/2016 + DECLARE i INT DEFAULT 0; + DECLARE lastCOMP BIGINT; -- Almacena el ultimo valor del Periodo + DECLARE strFILTRO VARCHAR(255) DEFAULT 'TRUE'; + + IF i_filtro THEN + SELECT `sql` INTO strFILTRO FROM filtros WHERE id = i_filtro; + END IF; + + SET corrector = 1; + + IF days < 0 OR days > 30 THEN + SET days = 15; + END IF; + + IF i_wh = NULL THEN + SET i_wh = 0; + END IF; + -- JGF 2015-04-16 cambio -21 por -22 para que la semana cuente de domingo a sabado + SET date_cyear_ini = TIMESTAMP(DATE(TIMESTAMPADD(DAY, -22 - WEEKDAY(v_date), v_date)), '00:00:00'); + SET date_cyear_end = TIMESTAMP(DATE(TIMESTAMPADD(DAY, (7 * week_count) -1, date_cyear_ini)), '23:59:59'); + -- Eliminamos el calculo del inventario para fechas en el pasado + + CALL article (); + + INSERT INTO article_inventory (article_id) + SELECT Id_Article FROM Articles a + JOIN Tipos t ON a.tipo_id = t.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = t.reino_id + WHERE (i_tipo = 0 OR a.tipo_id = i_tipo) + AND r.display <> 0; + + IF v_date < CURDATE() + THEN + ALTER TABLE `article_inventory` + ADD `buy_id` INT NOT NULL DEFAULT 0, + ADD `buy_date` DATE DEFAULT '2000-01-01', + ADD `life` INT DEFAULT 0, + ADD `sd` INT DEFAULT 0, + ADD `avalaible` INT DEFAULT 0, + ADD `visible` INT DEFAULT 0; + + ELSE + + CALL inventario_multiple_2 (v_date, i_wh, days); + + CALL article_multiple_buy (v_date, i_wh); + + CALL article_multiple_buy_date (v_date, i_wh); + + + END IF; + + + DROP TEMPORARY TABLE IF EXISTS wtable; + + CREATE TEMPORARY TABLE wtable ( + cy INT(6), + ly INT(6) + ); + + REPEAT + SET i = i + 1; + SET wperiod = vnperiod(TIMESTAMPADD(DAY, 7*(i - 1), date_cyear_ini)); -- PAK 11/01/2016 + INSERT INTO wtable(cy, ly) VALUES(wperiod, wperiod - 100); -- VALUES( ys * 100 + ws, (ys -1) * 100 + ws); -- PAK 11/01/2016 + + UNTIL i = 7 END REPEAT; + + + SELECT cy, ly INTO w1, y1 FROM wtable limit 1; + SELECT cy, ly INTO w2, y2 FROM wtable WHERE cy > w1 limit 1; + SELECT cy, ly INTO w3, y3 FROM wtable WHERE cy > w2 limit 1; + SELECT cy, ly INTO w4, y4 FROM wtable WHERE cy > w3 limit 1; + + SELECT cy, ly INTO w5, y5 FROM wtable WHERE cy > w4 limit 1; + SELECT cy, ly INTO w6, y6 FROM wtable WHERE cy > w5 limit 1; + SELECT cy, ly INTO w7, y7 FROM wtable WHERE cy > w6 limit 1; + DROP TEMPORARY TABLE wtable; + + SET cyear = YEAR(date_cyear_ini); + + -- Genera una tabla con los datos del año pasado. + + DROP TEMPORARY TABLE IF EXISTS last_year; + CREATE TEMPORARY TABLE last_year + (KEY (Id_Article)) + ENGINE = MEMORY + SELECT Id_Article + + ,CAST(SUM(IF(Periodo = y1, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek1 + ,CAST(SUM(IF(Periodo = y2, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek2 + ,CAST(SUM(IF(Periodo = y3, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek3 + ,CAST(SUM(IF(Periodo = y4, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek4 + ,CAST(SUM(IF(Periodo = y5, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek5 + ,CAST(SUM(IF(Periodo = y6, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek6 + ,CAST(SUM(IF(Periodo = y7, Cantidad, 0)) AS DECIMAL(10,0)) AS lweek7 + + ,CAST(SUM(IF(Periodo = y1, price, 0)) AS DECIMAL(10,0)) AS lprice1 + ,CAST(SUM(IF(Periodo = y2, price, 0)) AS DECIMAL(10,0)) AS lprice2 + ,CAST(SUM(IF(Periodo = y3, price, 0)) AS DECIMAL(10,0)) AS lprice3 + ,CAST(SUM(IF(Periodo = y4, price, 0)) AS DECIMAL(10,0)) AS lprice4 + ,CAST(SUM(IF(Periodo = y5, price, 0)) AS DECIMAL(10,0)) AS lprice5 + ,CAST(SUM(IF(Periodo = y6, price, 0)) AS DECIMAL(10,0)) AS lprice6 + ,CAST(SUM(IF(Periodo = y7, price, 0)) AS DECIMAL(10,0)) AS lprice7 + + FROM Comparativa + JOIN warehouse W on W.id = warehouse_id + WHERE (Periodo BETWEEN y1 and y7) + AND IF(i_wh = 0, W.is_comparative, i_wh = warehouse_id) + GROUP BY Id_Article; + + -- Genera una tabla con los datos de este año. + + DROP TEMPORARY TABLE IF EXISTS cur_year; + CREATE TEMPORARY TABLE cur_year + (KEY (Id_Article)) + ENGINE = MEMORY + SELECT Id_Article + + ,CAST(SUM(IF(week = w1, Total, 0)) AS DECIMAL(10,0)) AS cweek1 + ,CAST(SUM(IF(week = w2, Total, 0)) AS DECIMAL(10,0)) AS cweek2 + ,CAST(SUM(IF(week = w3, Total, 0)) AS DECIMAL(10,0)) AS cweek3 + ,CAST(SUM(IF(week = w4, Total, 0)) AS DECIMAL(10,0)) AS cweek4 + ,CAST(SUM(IF(week = w5, Total, 0)) AS DECIMAL(10,0)) AS cweek5 + ,CAST(SUM(IF(week = w6, Total, 0)) AS DECIMAL(10,0)) AS cweek6 + ,CAST(SUM(IF(week = w7, Total, 0)) AS DECIMAL(10,0)) AS cweek7 + + ,CAST(SUM(IF(week = w1, price, 0)) AS DECIMAL(10,0)) AS cprice1 + ,CAST(SUM(IF(week = w2, price, 0)) AS DECIMAL(10,0)) AS cprice2 + ,CAST(SUM(IF(week = w3, price, 0)) AS DECIMAL(10,0)) AS cprice3 + ,CAST(SUM(IF(week = w4, price, 0)) AS DECIMAL(10,0)) AS cprice4 + ,CAST(SUM(IF(week = w5, price, 0)) AS DECIMAL(10,0)) AS cprice5 + ,CAST(SUM(IF(week = w6, price, 0)) AS DECIMAL(10,0)) AS cprice6 + ,CAST(SUM(IF(week = w7, price, 0)) AS DECIMAL(10,0)) AS cprice7 + + FROM ( + SELECT A.Id_Article + ,CTS.period week + ,SUM(Cantidad) AS Total + ,TRUNCATE(SUM(Cantidad * IF(T.Fecha >= '2015-10-01',M.CostFixat,Preu * (100 - Descuento) / 100)),0) AS price + FROM Movimientos M + LEFT JOIN Tickets T ON T.Id_Ticket = M.Id_Ticket + INNER JOIN `time` CTS ON CTS.`date` = DATE(T.Fecha) + INNER JOIN Articles A USING (Id_Article) + INNER JOIN Tipos tp ON tp.tipo_id = A.tipo_id + LEFT JOIN reinos r ON r.id = tp.reino_id + JOIN warehouse W ON W.id = T.warehouse_id + WHERE Fecha BETWEEN date_cyear_ini AND date_cyear_end + AND T.Id_Cliente NOT IN(400,200) + AND IF(i_wh = 0, W.is_comparative, i_wh = T.warehouse_id) + AND r.display <> 0 + + GROUP BY A.Id_Article, week + ) t + GROUP BY Id_Article; + -- Genera la tabla con la comparativa. + + DROP TEMPORARY TABLE IF EXISTS remcom; + + SET strFILTRO = REPLACE(strFILTRO, 'Id_Article','A.Id_Article'); + SET strFILTRO = REPLACE(strFILTRO, 'tipo_id','tp.tipo_id'); + -- select * from article_inventory; + CALL util.exec (sql_printf + ( + 'SELECT + an.nicho, p.name Productor, C.Packing, C.Costefijo + ,A.Color, Id_Tipo as Tipo,A.tipo_id, o.Abreviatura as Origen, A.Categoria + ,A.Tallos, A.Medida, A.Article, TR.CodigoTrabajador + + ,cweek1, cweek2, cweek3, cweek4, cweek5, cweek6, cweek7 + ,lweek1, lweek2, lweek3, lweek4, lweek5, lweek6, lweek7 + + ,cprice1, cprice2, cprice3, cprice4, cprice5, cprice6, cprice7 + ,lprice1, lprice2, lprice3, lprice4, lprice5, lprice6, lprice7 + + ,A.Id_Article, i.buy_id , tp.life , CAST(IFNULL(i.sd,0) AS SIGNED) as sd + ,CAST(i.avalaible AS SIGNED) avalaible, CAST(i.visible AS SIGNED) visible, i.buy_date + ,E.Id_Proveedor AS provider_id, t.Orden, t.Tinta + ,A.offer, A.bargain, A.comments, A.relevancy + ,IF(cy.Id_Article IS NULL AND i.visible = 0 AND i.avalaible = 0 AND IFNULL(i.sd, 0) = 0, FALSE, TRUE) AS filtret + FROM vn2008.article_inventory i + JOIN vn2008.Articles A ON A.Id_Article = i.article_id + LEFT JOIN vn2008.Articles_nicho an ON A.Id_Article = an.Id_Article AND an.warehouse_id = %s + LEFT JOIN vn2008.producer p ON p.producer_id = A.producer_id + LEFT JOIN vn2008.Tipos tp ON A.tipo_id = tp.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + LEFT JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = tp.Id_Trabajador + LEFT JOIN vn2008.Tintas t ON t.Id_Tinta = A.color + LEFT JOIN vn2008.Compres C ON i.buy_id = C.Id_Compra + LEFT JOIN vn2008.Entradas E USING(Id_Entrada) + LEFT JOIN vn2008.Origen o ON o.id = A.id_origen + LEFT JOIN vn2008.last_year ly ON ly.Id_Article = A.Id_Article + LEFT JOIN vn2008.cur_year cy ON cy.Id_Article = A.Id_Article AND (i.avalaible <> 0 OR i.visible <> 0 OR cweek1 OR cweek2 OR cweek3 OR cweek4 + OR cweek5 OR cweek6 OR cweek7 OR lweek1 OR lweek2 OR lweek3 OR lweek4 OR lweek5 + OR lweek6 OR lweek7) + WHERE r.display <> 0 AND %s ' + + ,i_wh,strFILTRO + )); + + -- Destruye las tablas temporales creadas. + + DROP TEMPORARY TABLE last_year; + DROP TEMPORARY TABLE cur_year; + DROP TEMPORARY TABLE article_inventory; +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 DROP PROCEDURE IF EXISTS `compresFromTicket` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -23169,7 +24374,7 @@ BEGIN DECLARE vMidnight DATETIME DEFAULT TIMESTAMP(CURDATE(),'23:59:59'); DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,vMidnight); - DECLARE SAFE_ALERT_LEVEL INT DEFAULT 3; + DECLARE maxAlertLevel INT DEFAULT 2; DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; @@ -23223,6 +24428,7 @@ BEGIN GROUP BY item_id ) stock ON stock.item_id = m.Id_Article WHERE tp.confeccion + AND tls.alertLevel < maxAlertLevel AND wh.hasConfectionTeam AND t.Fecha BETWEEN CURDATE() AND vEndingDate AND m.Cantidad > 0; @@ -23365,7 +24571,16 @@ BEGIN DECLARE vWorkerCode VARCHAR(8); DECLARE vPassword VARCHAR(50); DECLARE vUsername VARCHAR(50) CHARSET utf8; - + DECLARE vOficial INT DEFAULT 1; + DECLARE vDiscount INT DEFAULT 3; + DECLARE vPayMethodFk INT DEFAULT 4; + DECLARE vDueDay INT DEFAULT 5; + DECLARE vDefaultCredit INT DEFAULT 300; + DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; + DECLARE vHasCoreVnl TINYINT(1) DEFAULT 1; + DECLARE vMandateType INT DEFAULT 2; + + ############################################################################## #### GENERAR CLIENTE ############################################################################## @@ -23378,9 +24593,49 @@ BEGIN SELECT (MAX(Id_Cliente) + 1) INTO vClient FROM Clientes WHERE Id_Cliente < 999999; - INSERT INTO Clientes (Id_Cliente, Cliente, Domicilio, `IF`, Telefono, province_id, Poblacion, CodPostal, RazonSocial, Contacto, Oficial, Descuento, Codpos, pay_met_id, Vencimiento, Credito) - SELECT vClient, Concat('TR ', vName, ' ', vCognames), vAddress, vDNI, vPhone, vProvince, vTown, vPostalCode, CONCAT(vCognames, ' ', vName), vName, 1, 3, vPostalCode, 4, 5, 300; + INSERT INTO Clientes ( + Id_Cliente, + Cliente, + Domicilio, + `IF`, + Telefono, + province_id, + Poblacion, + CodPostal, + RazonSocial, + Contacto, + Oficial, + Descuento, + Codpos, + pay_met_id, + Vencimiento, + Credito, + contabilizado, + coreVnl) + SELECT + vClient, + Concat('TR ', vName, ' ', vCognames), + vAddress, + vDNI, + vPhone, + vProvince, + vTown, + vPostalCode, + CONCAT(vCognames, ' ', vName), + vName, + vOficial, + vDiscount, + vPostalCode, + vPayMethodFk, + vDueDay, + vDefaultCredit, + vIsTaxDataChecked, + vHasCoreVnl; + + INSERT INTO mandato (Id_Cliente, empresa_id, idmandato_tipo) + VALUES (vClient, vCompany, vMandateType); END IF; + ############################################################################## #### GENERAR USUARIO @@ -23401,13 +24656,13 @@ BEGIN -- Alta del usuario. INSERT INTO account.user (id, role, `name`, `password`, active) VALUES (vClient, 1, LCASE(vUsername), MD5(LCASE(vPassword)), 1); SET vUser = vClient; - INSERT INTO account.account (id, lastchange, `expire`) values (vClient, CURRENT_DATE(), CURRENT_DATE()); + INSERT INTO account.account SET id = vClient; ELSE -- Alta del usuario. INSERT INTO account.user (role, `name`, `password`, active) VALUES (1, LCASE(vUsername), MD5(LCASE(vPassword)), 1); SET vUser = LAST_INSERT_ID(); - INSERT INTO account.account (id, lastchange ,`expire`) values (vUser, CURRENT_DATE(), CURRENT_DATE()); + INSERT INTO account.account SET id = vUser; END IF; ############################################################################## @@ -23909,8 +25164,7 @@ BEGIN -- Insertamos los tickets que ya tienen expediciones, que fallaran si se repite la clave primaria. - INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) - SELECT p.name, e.ticket_id, COUNT(e.ticket_id) + INSERT INTO zeleVOL(Provincia, Id_Ticket, Bultos) SELECT p.name, e.ticket_id, COUNT(e.ticket_id) FROM expeditions e JOIN Tickets t ON ticket_id = Id_Ticket JOIN Consignatarios c USING(Id_Consigna) @@ -23944,8 +25198,7 @@ BEGIN GROUP BY p.name, Id_Ticket ) sub GROUP BY province ON DUPLICATE KEY UPDATE Faltan = Faltan; - - -- Mostramos el resultado + -- Mostramos el resultado SELECT Provincia, COUNT(Id_Ticket) expediciones, SUM(Bultos) Bultos, SUM(Faltan) Prevision FROM zeleVOL @@ -24379,6 +25632,33 @@ join warehouse w on w.id = mov.warehouse_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 DROP PROCEDURE IF EXISTS `entradaCambioUpdate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `entradaCambioUpdate`(IN vIdEntrada INT) +BEGIN + + DECLARE vMoneda INT; + + SELECT Id_Moneda INTO vMoneda FROM Entradas WHERE Id_Entrada = vIdEntrada; + + UPDATE Entradas + SET comision = getComision(vIdEntrada, vMoneda) + WHERE Id_Entrada = vIdEntrada; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24481,6 +25761,29 @@ SET c.Cantidad = c.Cantidad - sub.Cantidad WHERE Id_Entrada = Id_Minuendo; +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 DROP PROCEDURE IF EXISTS `entryComisionUpdate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `entryComisionUpdate`(IN vIdEntrada INT) +BEGIN + + UPDATE Entradas + SET comision = getComision(vIdEntrada) + WHERE Id_Entrada = vIdEntrada; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24627,6 +25930,29 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entryUpdateComision` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `entryUpdateComision`(IN vIdEntrada INT) +BEGIN + + UPDATE Entradas + SET comision = getComision(vIdEntrada, Id_Moneda) + WHERE Id_Entrada = vIdEntrada; + +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 DROP PROCEDURE IF EXISTS `entryWithItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25929,6 +27255,114 @@ CREATE DEFINER=`root`@`%` PROCEDURE `historico`(IN idART INT, IN wh INT, IN v_vi BEGIN DECLARE datFEC DATETIME; +SELECT Fechainventario INTO datFEC FROM tblContadores; +SET @a = 0; +SELECT DATE(Fecha) AS Fecha, + Entrada, + Salida, + OK, + Alias, + Referencia, + id, + @a := @a + IFNULL(Entrada,0) - IFNULL(Salida,0) as acumulado, + F5, + v_virtual, + Calidad,CodigoTrabajador +FROM + + ( SELECT TR.landing as Fecha, + C.Cantidad as Entrada, + NULL as Salida, + (TR.received != FALSE) as OK, + P.Proveedor as Alias, + E.Referencia as Referencia, + E.Id_Entrada as id, + TR.delivered as F5, + 0 as Calidad, tra.CodigoTrabajador + FROM Compres C + JOIN Entradas E USING (Id_Entrada) + JOIN travel TR ON TR.id = E.travel_id + JOIN Proveedores P USING (Id_Proveedor) + LEFT JOIN Articles a ON a.Id_Article = C.Id_Article + LEFT JOIN Tipos ti ON ti.Id_Tipo = a.tipo_id + LEFT JOIN Trabajadores tra ON tra.Id_Trabajador = ti.Id_Trabajador + WHERE TR.landing >= datFEC + AND wh IN (TR.warehouse_id , 0) + AND C.Id_Article = idART + AND E.Inventario = 0 + + UNION ALL + + SELECT TR.shipment as Fecha, + NULL as Entrada, + C.Cantidad as Salida, + TR.delivered as OK, + P.Proveedor as Alias, + E.Referencia as Referencia, + E.Id_Entrada as id, + TR.delivered as F5, + 0 as Calidad, tra.CodigoTrabajador + + FROM Compres C + JOIN Entradas E USING (Id_Entrada) + JOIN travel TR ON TR.id = E.travel_id + JOIN warehouse ON warehouse.id = TR.warehouse_id_out + JOIN Proveedores P USING (Id_Proveedor) + LEFT JOIN Articles a ON a.Id_Article = C.Id_Article + LEFT JOIN Tipos ti ON ti.Id_Tipo = a.tipo_id + LEFT JOIN Trabajadores tra ON tra.Id_Trabajador = ti.Id_Trabajador + WHERE TR.shipment >= datFEC + AND wh IN (TR.warehouse_id_out,0) + AND Id_Proveedor <> 4 + AND C.Id_Article = idART + AND E.Inventario = 0 + AND fuente = 0 + + UNION ALL + + SELECT T.Fecha as Fecha, + NULL as Entrada, + M.Cantidad as Salida, + (IFNULL(ts.alertLevel,0) > 1 OR ok ) as OK, + T.Alias as Alias, + T.Localizacion as Referencia, + T.Id_Ticket as id, + FALSE EtiquetasEmitidas, + C.Calidad, tr.CodigoTrabajador + + FROM Movimientos M + JOIN Tickets T USING (Id_Ticket) + LEFT JOIN vn.ticketState ts ON ts.ticket = T.Id_Ticket + JOIN Clientes C ON C.Id_Cliente = T.Id_Cliente + LEFT JOIN Trabajadores tr ON tr.Id_Trabajador = C.Id_Trabajador + WHERE T.Fecha >= datFEC + AND M.Id_Article = idART + AND wh IN (T.warehouse_id , 0) + + ) AS Historico +ORDER BY Fecha, OK DESC, Entrada DESC; + + +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 DROP PROCEDURE IF EXISTS `historicokk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `historicokk`(IN idART INT, IN wh INT, IN v_virtual INT) +BEGIN +DECLARE datFEC DATETIME; + SELECT Fechainventario INTO datFEC FROM tblContadores; SET @a = 0; SELECT DATE(Fecha) AS Fecha, @@ -26752,15 +28186,15 @@ BEGIN SET strFILTRO = REPLACE(strFILTRO, 'Id_Article','A.Id_Article'); - CALL sql_query (sql_printf( - 'CREATE TEMPORARY TABLE article_selection + CALL util.exec (sql_printf( + 'CREATE TEMPORARY TABLE vn2008.article_selection ENGINE = MEMORY - SELECT Id_Article - FROM Articles A - LEFT JOIN Tipos USING(tipo_id) - LEFT JOIN Trabajadores TR ON TR.Id_Trabajador = Tipos.Id_Trabajador - LEFT JOIN Tintas ON A.color = Tintas.Id_Tinta - LEFT JOIN Origen ON Origen.id = A.id_origen + SELECT A.Id_Article + FROM vn2008.Articles A + LEFT JOIN vn2008.Tipos t USING(tipo_id) + LEFT JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = t.Id_Trabajador + LEFT JOIN vn2008.Tintas tn ON A.color = tn.Id_Tinta + LEFT JOIN vn2008.Origen o ON o.id = A.id_origen WHERE %s AND %s AND reino_id != %v' ,IF(i_tipo, CONCAT('tipo_id = ', i_tipo), 'TRUE') ,strFILTRO @@ -28151,9 +29585,6 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `inventario_valorado`(IN d_FEC DATE, IN bol_DESGLOSE BOOLEAN) BEGIN - - - DECLARE d_INV DATE; DECLARE bolREVERSE BOOLEAN DEFAULT 0; DECLARE d_INV2 DATE; @@ -28166,8 +29597,6 @@ BEGIN ORDER BY landing DESC LIMIT 1; - - SET bolREVERSE = IF (d_INV is null, 1, 0); @@ -28274,7 +29703,7 @@ BEGIN INNER JOIN Articles A USING(Id_Article) INNER JOIN Tipos t USING(tipo_id) INNER JOIN warehouse w ON w.id = warehouse_id - WHERE T.Fecha = d_FEC + WHERE date(T.Fecha) = d_FEC AND (d_FEC <> CURDATE() or (M.OK <> 0 or T.Etiquetasemitidas <> 0 )) AND NOT w.fuente AND reino_id NOT IN (7) @@ -28294,14 +29723,16 @@ BEGIN IF bol_DESGLOSE THEN - SELECT w_id, Id_Article, Article, Medida, Cantidad,Id_Tipo,reino_id, coste, cast(total as decimal(10,2)) total + SELECT inv.w_id, a.Id_Article, a.Article, a.Medida, inv.Cantidad, tp.Id_Tipo, + tp.reino_id, inv.coste, cast(inv.total as decimal(10,2)) total, an.nicho FROM inv - JOIN warehouse w on w.id = w_id - JOIN Articles USING(Id_Article) - JOIN Tipos TP USING(tipo_id) + JOIN warehouse w on w.id = w_id + JOIN Articles a ON a.Id_Article = inv.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + JOIN Articles_nicho an ON an.Id_Article = a.Id_Article AND an.warehouse_id = w.id where w.valuatedInventory - and total > 0 - order by total desc; + and inv.total > 0 + order by inv.total desc; ELSE @@ -28315,253 +29746,6 @@ BEGIN 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 DROP PROCEDURE IF EXISTS `inventario_valorado_FTH` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `inventario_valorado_FTH`(IN d_FEC DATE, IN bol_DESGLOSE BOOLEAN, IN inv_value_new DOUBLE) -BEGIN - - - DECLARE emp_id INT DEFAULT 791; - DECLARE inv_value DOUBLE ; - - DECLARE d_INV DATE; - DECLARE bolREVERSE BOOLEAN DEFAULT 0; - DECLARE d_INV2 DATE; - - SELECT landing INTO d_INV - - FROM travel TR - - INNER JOIN Entradas E ON E.travel_id = TR.id - - WHERE landing <= d_FEC - - AND E.Id_Proveedor = 4 - - ORDER BY landing DESC - - LIMIT 1; - - - - SET bolREVERSE = IF (d_INV is null, 1, 0); - - - IF bolREVERSE THEN - - SELECT landing INTO d_INV2 - - FROM travel TR - - INNER JOIN Entradas E ON E.travel_id = TR.id - - WHERE landing >= d_FEC - - AND E.Id_Proveedor = 4 - - ORDER BY landing ASC - - LIMIT 1; - - SET d_INV = TIMESTAMPADD(DAY,1,d_FEC); - SET d_FEC = d_INV2; - - - - END IF; - -DROP TEMPORARY TABLE IF EXISTS inv; - -CREATE TEMPORARY TABLE inv - (w_id SMALLINT, - Id_Article BIGINT, - cantidad INT, - landing DATE, - Proveedor VARCHAR(30), - Id_Entrada BIGINT, - coste DOUBLE DEFAULT 0, - total DOUBLE DEFAULT 0) ENGINE = MEMORY; - - -ALTER TABLE inv ADD PRIMARY KEY USING HASH (w_id, Id_Article); - - - -IF bolREVERSE = 1 THEN - - INSERT INTO inv(w_id, Id_Article, cantidad) - SELECT TR.warehouse_id, C.Id_Article, SUM(C.Cantidad) - FROM Compres C - INNER JOIN Articles A USING(Id_Article) - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - INNER JOIN Tipos t USING(tipo_id) - INNER JOIN warehouse w ON w.id = warehouse_id - WHERE landing = d_FEC - AND E.Id_Proveedor = 4 - AND NOT w.fuente - AND A.tipo_id NOT IN (21,7) - AND reino_id NOT IN (6,7) - GROUP BY TR.warehouse_id, C.Id_Article; - - - -END IF; - - - - INSERT INTO inv(w_id, Id_Article, cantidad) - SELECT TR.warehouse_id, C.Id_Article, C.Cantidad * IF(bolREVERSE,-1,1) - FROM Compres C - INNER JOIN Articles A USING(Id_Article) - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - INNER JOIN Tipos t USING(tipo_id) - INNER JOIN warehouse w ON w.id = TR.warehouse_id - WHERE landing BETWEEN d_INV AND TIMESTAMPADD(DAY, IF(bolREVERSE,-1,0) ,d_FEC) - AND NOT redada - AND NOT w.fuente - AND reino_id NOT IN (6,7) - AND A.tipo_id NOT IN (21,7) - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (C.Cantidad * IF(bolREVERSE,-1,1)); - --- SELECT * FROM inv WHERE Id_Article = 10067; - - INSERT INTO inv(w_id, Id_Article, cantidad) - SELECT TR.warehouse_id_out, C.Id_Article, C.Cantidad * IF(bolREVERSE,1,-1) - FROM Compres C - INNER JOIN Articles A USING(Id_Article) - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - INNER JOIN Tipos t USING(tipo_id) - INNER JOIN warehouse w ON w.id = warehouse_id_out - WHERE shipment BETWEEN d_INV AND TIMESTAMPADD(DAY, IF(bolREVERSE,-1,0) ,d_FEC) - AND NOT redada - AND NOT w.fuente - AND reino_id NOT IN (6,7) - AND A.tipo_id NOT IN (21,7) - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (C.Cantidad * IF(bolREVERSE,1,-1)); - - - --- SELECT * FROM inv WHERE Id_Article = 10067; - - INSERT INTO inv(w_id, Id_Article, cantidad) - SELECT w.id, M.Id_Article, M.Cantidad * IF(bolREVERSE,1,-1) - FROM Movimientos M - INNER JOIN Tickets T USING (Id_Ticket) - INNER JOIN Clientes C USING(Id_Cliente) - INNER JOIN Articles A USING(Id_Article) - INNER JOIN Tipos t USING(tipo_id) - INNER JOIN warehouse w ON w.id = warehouse_id - WHERE T.Fecha BETWEEN d_INV AND TIMESTAMPADD(DAY, -1 ,d_FEC) - AND empresa_id = emp_id AND NOT w.fuente - AND reino_id NOT IN (6,7) - AND A.tipo_id NOT IN (21,7) - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + M.Cantidad * IF(bolREVERSE,1,-1); - --- SELECT * FROM inv WHERE Id_Article = 10067; - - INSERT INTO inv(w_id, Id_Article, cantidad) - SELECT w.id, M.Id_Article, M.Cantidad * IF(bolREVERSE,0,-1) - FROM Movimientos M - INNER JOIN Tickets T USING (Id_Ticket) - INNER JOIN Clientes C USING(Id_Cliente) - INNER JOIN Articles A USING(Id_Article) - INNER JOIN Tipos t USING(tipo_id) - INNER JOIN warehouse w ON w.id = warehouse_id - WHERE T.Fecha = d_FEC - AND (d_FEC <> CURDATE() or (M.OK <> 0 or T.Etiquetasemitidas <> 0 )) - AND NOT w.fuente - AND empresa_id = emp_id - AND reino_id NOT IN (6,7) - AND A.tipo_id NOT IN (21,7) - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + M.Cantidad * IF(bolREVERSE,0,-1); - --- SELECT * FROM inv WHERE Id_Article = 10067; - -UPDATE inv -JOIN ( SELECT * FROM - ( - SELECT Id_Article - , warehouse_id - , Id_Entrada - , landing - , IF(Id_Proveedor = 13 AND warehouse_id_out = 7, 'VNH',Proveedor) Proveedor - , ifnull(C.Costefijo,0) - + IFNULL(C.Embalajefijo,0) - + IFNULL(C.Portefijo,0) - + IFNULL(C.Comisionfija,0) cost - FROM Compres C - JOIN Entradas E using(Id_Entrada) - JOIN Proveedores P using(Id_Proveedor) - JOIN travel tr on tr.id = travel_id - WHERE empresa_id = emp_id - AND landing between '2015-01-02' and '2015-08-31' - AND noVincular = FALSE - AND E.Id_Proveedor NOT IN (12,4,30,850,963,IF(warehouse_id_out = 7, -0.48, 13)) - AND NOT redada - ORDER BY landing DESC - ) sub - GROUP BY Id_Article, warehouse_id - ) lb ON w_id = lb.warehouse_id AND inv.Id_Article = lb.Id_Article - -SET total = inv.cantidad * cost, -coste = cost, -inv.landing = lb.landing, -inv.Proveedor = lb.Proveedor, -inv.Id_Entrada = lb.Id_Entrada -WHERE inv.cantidad > 0; - -DELETE FROM inv WHERE Cantidad IS NULL or Cantidad <= 0 or total = 0; - - --- Incrementamos las cantidades para alcanzar el valor fijado al inicio -SELECT SUM(total) INTO inv_value FROM inv; - -UPDATE inv SET cantidad = ROUND(cantidad * inv_value_new / inv_value ,0); -UPDATE inv SET total = cantidad * coste; - - -IF bol_DESGLOSE THEN - - - - -SELECT inv.*, Article, Medida, Id_Tipo,reino_id -FROM inv -JOIN Articles USING(Id_Article) -JOIN Tipos TP USING(tipo_id) -where w_id IN (1,44, 5) -- JGF 2015-06-08 afegeix 41 a peticio de MAV -and total > 0 -order by total desc; - -ELSE - -SELECT w.name as Almacen, r.reino as Reino, total as Euros -FROM inv -JOIN warehouse w ON w.id = w_id -JOIN Articles A USING(Id_Article) -JOIN Tipos t USING(tipo_id) -JOIN reinos r ON r.id = t.reino_id -; - -END IF; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28572,24 +29756,24 @@ 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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `inventory_refresh`() -BEGIN -/** - * Recalcula los inventarios de todos los almacenes. - */ - INSERT INTO daily_task_log - SET consulta = 'inventory_refresh-begin'; - - CALL article_inventory_warehouses (TIMESTAMPADD(DAY, -10, CURDATE())); - - INSERT INTO daily_task_log - SET consulta = 'inventory_refresh-end'; +BEGIN +/** + * Recalcula los inventarios de todos los almacenes. + */ + INSERT INTO daily_task_log + SET consulta = 'inventory_refresh-begin'; + + CALL article_inventory_warehouses (TIMESTAMPADD(DAY, -10, CURDATE())); + + INSERT INTO daily_task_log + SET consulta = 'inventory_refresh-end'; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28801,7 +29985,7 @@ BEGIN SELECT * FROM tmp.updateInter; INSERT INTO Tickets_dits (idaccion_dits,Id_Trabajador,Id_Ticket,value_old,value_new) - SELECT 111/*Factura serie*/ ,Id_Trabajador,ti.ticket_id,NULL,serie FROM ticket_invoice ti; + SELECT 111/*Factura serie*/,Id_Trabajador,ti.ticket_id,NULL,serie FROM ticket_invoice ti; END IF; DROP TEMPORARY TABLE `iva_base`; @@ -29354,219 +30538,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_disp_virt` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `item_disp_virt`(v_wh SMALLINT, v_date DATETIME, id_single INT, v_cache INT) -BEGIN - DROP TEMPORARY TABLE IF EXISTS wh_father; - DROP TEMPORARY TABLE IF EXISTS wh_son; - DROP TEMPORARY TABLE IF EXISTS article_inventory; - - CREATE TEMPORARY TABLE wh_father - ( - wh SMALLINT, - INDEX i (wh) - ) - ENGINE = MEMORY; - - CREATE TEMPORARY TABLE wh_son - ( - wh INT, - INDEX i (wh) - ) - ENGINE = MEMORY; - - INSERT INTO wh_father(wh) VALUES(v_wh); - INSERT INTO wh_son(wh) VALUES(v_wh); - - -- Sols es crea la variable @wh_son quan es crida desde traslado JGF 2015-01-30 - IF @wh_son THEN - INSERT INTO wh_son(wh) VALUES(@wh_son); - END IF; - - CALL item_travel_fixed(v_wh,v_date); - SET @@max_sp_recursion_depth = 10; - - CALL item_disp_virt1 (v_wh, v_date, 0, id_single, v_cache); -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 DROP PROCEDURE IF EXISTS `item_disp_virt1` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `item_disp_virt1`(v_wh SMALLINT, v_date DATETIME, direccion TINYINT, id_single INT, v_cache INT) -BEGIN - DECLARE wh_cursor,done TINYINT DEFAULT 0; - DECLARE v_shipment_aux DATETIME DEFAULT NULL; - DECLARE v_date_cur DATETIME DEFAULT CURDATE(); - DECLARE v_inv DATETIME; - DECLARE v_camp DATETIME; - DECLARE b_fprice TINYINT; - - -- selecciona tots els fills del @v_wh(actual) - DECLARE cur1 CURSOR FOR - SELECT son FROM warehouse_tree_bidi - WHERE father = v_wh AND son NOT IN (SELECT DISTINCT wh FROM wh_son); - - -- selecciona tots els pares del v_wh(actual) - DECLARE cur2 CURSOR FOR - SELECT father FROM warehouse_tree_bidi - WHERE son = v_wh AND father NOT IN (SELECT DISTINCT wh FROM wh_father); - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - - -SELECT FechaInventario, TIMESTAMPADD(DAY, -campaign_life, campaign) - INTO v_inv, v_camp FROM tblContadores LIMIT 1; - -- Crea una tabla amb el @v_wh - CALL hedera.sql_query (sql_printf('DROP TEMPORARY TABLE IF EXISTS %t;',v_wh)); - CALL hedera.sql_query (sql_printf('create temporary table %t - ( - article_id INT PRIMARY KEY, - amount DOUBLE(8,2) - )ENGINE = MEMORY;' - ,v_wh)); - -- Si es campanya fa el calcul del disponible senzill - IF v_camp >= v_date_cur AND v_camp <= v_date THEN - SET v_date_cur = v_camp; - ELSE - OPEN cur1; - FETCH cur1 INTO wh_cursor; - - -- mentre queden fills.. - WHILE !done DO - -- calcula la data per a la cual calcular el disponible del fill - SELECT MIN(landing) INTO v_shipment_aux - FROM travel t - WHERE t.warehouse_id_out = v_wh - AND t.warehouse_id = wh_cursor - AND t.shipment >= v_date - AND NOT t.delivered - AND t.landing >= t.shipment; - - -- afegeix en la taula wh_son el v_wh no tornar-lo a calcular - INSERT INTO wh_son(wh) VALUES (v_wh); - -- calcula del disponible del fill - CALL item_disp_virt1 (wh_cursor, v_shipment_aux, -1, id_single, v_cache); - - -- Li resta al @v_wh els negatius dels fills - CALL hedera.sql_query (sql_printf ( - 'INSERT INTO %t (article_id,amount) - SELECT item_id ,available FROM vn2008.tmp_item WHERE available < 0 - ON DUPLICATE KEY UPDATE - amount = amount + VALUES(amount);' - ,v_wh - )); - - FETCH cur1 INTO wh_cursor; - END WHILE; - CLOSE cur1; - - SET v_shipment_aux = NULL; - - -- si direccion < 0 sols mira fills, - -- si direccion > 0 mira pare i fills - -- si direccion = 0 mira pare i fills, a més es el cas base - IF direccion >= 0 THEN - - SET done = 0; - OPEN cur2; - FETCH cur2 INTO wh_cursor; - -- mentre queden pares.. - WHILE !done DO - -- calcula la data per a la cual calcular el disponible del pare - SELECT MAX(shipment) INTO v_shipment_aux FROM travel t - WHERE t.warehouse_id_out = wh_cursor - AND t.warehouse_id = v_wh - AND t.delivered = 0 - AND t.shipment >= CURDATE() - AND t.landing <= v_date; - -- afegeix en la taula wh_son i wh_father el v_wh no tornar-lo a calcular - INSERT INTO wh_son(wh) VALUES (v_wh); - INSERT INTO wh_father(wh) VALUES (v_wh); - IF v_shipment_aux IS NOT NULL THEN - -- calcula el disponible per al pare - CALL item_disp_virt1(wh_cursor,v_shipment_aux,1, id_single, v_cache); - -- li suma al v_wh el disponible positiu del pare - CALL hedera.sql_query (sql_printf('INSERT INTO %t (article_id,amount) - SELECT item_id ,available FROM vn2008.tmp_item WHERE available > 0 - ON DUPLICATE KEY UPDATE - amount = amount + VALUES(amount);',v_wh)); - ELSE - - -- travels provinents del pare després de FechaTicket - SELECT MIN(shipment) INTO v_shipment_aux FROM travel t - WHERE t.warehouse_id_out = wh_cursor - AND t.warehouse_id = v_wh - AND t.delivered = 0 - AND t.shipment >= CURDATE() -- avans AND t.shipment > CURDATE() - AND t.landing >= v_date; -- avans AND t.landing >= v_date; 23/09/11 - CALL item_disp_virt1(wh_cursor,v_shipment_aux,2, id_single, v_cache); - END IF; - FETCH cur2 INTO wh_cursor; - - END WHILE; - - END IF; - END IF; - - -- calcula el stock, que es igual al visible - CALL item_stock (v_wh, v_date,NULL); - - CALL item_stock_avail (v_wh, v_date,NULL,direccion); - - -- Li afegeix al disponible simple del v_wh el virtual - CALL hedera.sql_query (sql_printf('INSERT INTO vn2008.tmp_item ( item_id, available) - SELECT article_id, amount FROM %t - ON DUPLICATE KEY UPDATE - available = available + VALUES(available);',v_wh)); - -- si es el cas base - IF !direccion THEN - IF v_date = curdate() THEN - CALL item_stock_visible (v_wh,NULL); - END IF; - DELETE FROM cache_a WHERE cache_id = v_cache; - - CALL hedera.sql_query (sql_printf ( - 'INSERT INTO vn2008.cache_a (cache_id, item_id, visible, available, virtual, future) - SELECT %v, item_id, visible, available, IFNULL(amount,0) virtual, future - FROM vn2008.tmp_item - LEFT JOIN %t ON item_id = article_id - ON DUPLICATE KEY UPDATE - visible = VALUES(visible), - available = VALUES(available), - virtual = VALUES(virtual), - future = VALUES(future);' - ,v_cache - ,v_wh - - )); - END IF; - - CALL hedera.sql_query (sql_printf ('DROP TEMPORARY TABLE IF EXISTS %t;', v_wh)); -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 DROP PROCEDURE IF EXISTS `item_express` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -29687,18 +30658,16 @@ BEGIN * @param v_date_end Fecha final * @table tmp.item_last_buy_from_interval **/ - - - IF v_date_end IS NULL THEN SET v_date_end = v_date_ini; END IF; - /* IF v_date_end < v_date_ini THEN + + IF v_date_end < v_date_ini THEN SET v_date_ini = TIMESTAMPADD(MONTH,-1,v_date_end); END IF; -*/ + DROP TEMPORARY TABLE IF EXISTS tmp.item_last_buy_from_interval; CREATE TEMPORARY TABLE tmp.item_last_buy_from_interval ENGINE = MEMORY @@ -29728,13 +30697,13 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `item_new`() -BEGIN - CREATE TEMPORARY TABLE item - ( - item_id INT UNSIGNED NOT NULL, - UNIQUE KEY USING HASH (item_id) - ) - ENGINE = MEMORY; +BEGIN + CREATE TEMPORARY TABLE item + ( + item_id INT UNSIGNED NOT NULL, + UNIQUE KEY USING HASH (item_id) + ) + ENGINE = MEMORY; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29813,7 +30782,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `item_stock_avail`(IN v_wh TINYINT, IN v_date DATETIME, IN id_single INT,IN direccion TINYINT) BEGIN @@ -29855,7 +30824,7 @@ BEGIN SET _self = CONCAT(v_wh, 'virtual'); -- crea una taula amb el nom del warehousevirtual - CALL hedera.sql_query (sql_printf('CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t + CALL sql_query (sql_printf('CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t ( item_id INT(11), dat DATE, @@ -29913,7 +30882,7 @@ SET query = sql_printf ( -- crea una taula TEMPORAL per al fill SELECT CONCAT(son,'virtual') A INTO _son FROM warehouse_tree_bidi WHERE father = v_wh LIMIT 1; - CALL hedera.sql_query (sql_printf('CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t + CALL sql_query (sql_printf('CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t ( item_id INT(11), dat DATE, @@ -30004,7 +30973,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `item_stock_avail_new`(IN v_wh TINYINT, IN v_date DATETIME, IN id_single INT,IN direccion TINYINT) BEGIN @@ -30052,7 +31021,7 @@ BEGIN -- Crea una taula amb el nom del almacen virtual - CALL hedera.sql_query (sql_printf('CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t + CALL sql_query (sql_printf('CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t ( item_id INT(11), dat DATE, @@ -30118,7 +31087,7 @@ BEGIN -- Crea una tabla temporar pare el hijo SELECT CONCAT(son,'virtual') A INTO _son FROM warehouse_tree_bidi WHERE father = v_wh LIMIT 1; - CALL hedera.sql_query (sql_printf( + CALL sql_query (sql_printf( 'CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.%t ( item_id INT(11), @@ -30346,7 +31315,7 @@ BEGIN AND landing BETWEEN v_date_start AND v_campaign ,TIMESTAMPADD(DAY, 1, v_campaign) ,landing - ) */ landing + ) */landing FROM travel_top WHERE wh_out <> v_wh ORDER BY landing @@ -30617,7 +31586,7 @@ UNTIL v_travel = -1 END REPEAT; AND landing BETWEEN v_date_start AND v_campaign ,TIMESTAMPADD(DAY, 1, v_campaign) ,landing - ) */ landing + ) */landing FROM travel_top WHERE wh_out <> v_wh ORDER BY landing @@ -30717,6 +31686,109 @@ and Fecha > '2015-01-01' where sub4.Id_Cliente 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 DROP PROCEDURE IF EXISTS `manaEraser` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `manaEraser`(vTicket INT) +BEGIN + + DECLARE vComponentOld INT; + DECLARE vComponentNew INT; + + SELECT Id_Componente + INTO vComponentOld + FROM tarifa_componentes + WHERE Componente = 'maná'; + + SELECT Id_Componente + INTO vComponentNew + FROM tarifa_componentes + WHERE Componente = 'rebaja manual'; + + UPDATE Movimientos_componentes mc + JOIN Movimientos m using(Id_Movimiento) + SET mc.Id_Componente = vComponentNew + WHERE mc.Id_Componente = vComponentOld + AND m.Id_Ticket = vTicket; + +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 DROP PROCEDURE IF EXISTS `manaRequery` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `manaRequery`(worker INTEGER) +BEGIN + +DECLARE MyFechaDesde DATE; + +SELECT max(dated) INTO MyFechaDesde +FROM bs.manaCustomer; + + +REPLACE bs.mana_spellers (Id_Trabajador, used) + + SELECT worker, sum(mana) FROM + + ( + SELECT Cantidad * Valor as mana + FROM vn2008.Tickets t + JOIN Consignatarios cs using(Id_Consigna) + JOIN Clientes c on c.Id_Cliente = cs.Id_Cliente + JOIN Movimientos m using(Id_Ticket) + JOIN Movimientos_componentes mc using(Id_Movimiento) + WHERE c.Id_Trabajador = worker AND Id_Componente IN (39, 37) -- maná auto y maná + AND Fecha > MyFechaDesde + + UNION ALL + + SELECT - Entregado + FROM Recibos r + JOIN Clientes c using(Id_Cliente) + WHERE c.Id_Trabajador = worker AND Id_Banco = 66 + AND Fechacobro > MyFechaDesde + + UNION ALL + + SELECT g.Importe + FROM Greuges g + JOIN Clientes c using(Id_Cliente) + WHERE c.Id_Trabajador = worker AND Greuges_type_id = 3 -- Maná + AND Fecha > MyFechaDesde + + UNION ALL + + SELECT mana + FROM bs.manaCustomer mc + JOIN vn2008.Clientes c ON c.Id_Cliente = mc.Id_Cliente + WHERE c.Id_Trabajador = worker AND dated = MyFechaDesde + ) sub; + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31046,101 +32118,92 @@ BEGIN DECLARE idC INT; DECLARE newFEC DATE; DECLARE intWarehouse INT; - DECLARE userNUM INT; DECLARE intEmpresa INT; DECLARE IdConsignatario INT; DECLARE intIdAgencia INT; DECLARE Id_NEWTICKET BIGINT; DECLARE Id_NEWMOVIMIENTO BIGINT; DECLARE datLanding DATE; - DECLARE v_start DATETIME; - DECLARE v_end DATETIME; + DECLARE v_start DATETIME; + DECLARE v_end DATETIME; DECLARE intTicketActual INT; - DECLARE SYSTEM_WORKER INT DEFAULT 20; - - SELECT Id_Trabajador INTO userNUM - FROM Trabajadores - WHERE user_id = account.userGetId(); - - IF userNUM IS NULL THEN - SET userNUM = 33; - end IF; + DECLARE SYSTEM_WORKER INT DEFAULT 20; - SELECT Id_Cliente - , Fecha - , warehouse_id - , empresa_id - , Id_Consigna - , Id_Agencia - , Landing - , Id_Ticket - - INTO idC - , newFEC - , intWarehouse - , intEmpresa - , IdConsignatario - , intIdAgencia - , datLanding - , intTicketActual - FROM Tickets t - JOIN Movimientos m using(Id_Ticket) - WHERE Id_Movimiento = idMOV; + SELECT Id_Cliente + , Fecha + , warehouse_id + , empresa_id + , Id_Consigna + , Id_Agencia + , Landing + , Id_Ticket + + INTO idC + , newFEC + , intWarehouse + , intEmpresa + , IdConsignatario + , intIdAgencia + , datLanding + , intTicketActual + + FROM Tickets t + JOIN Movimientos m using(Id_Ticket) + WHERE Id_Movimiento = idMOV; + + -- Busca un ticket existente que coincida con los parametros del nuevo pedido + + SET v_start = TIMESTAMP(newFEC); + SET v_end = TIMESTAMP(newFEC, '23:59:59'); + + SELECT Id_Ticket INTO Id_NEWTICKET + FROM vn2008.Tickets t + WHERE IdConsignatario = t.Id_Consigna + AND intWarehouse = t.warehouse_id + AND intIdAgencia = t.Id_Agencia + AND datLanding <=> t.Landing + AND t.Fecha BETWEEN v_start AND v_end -- uso BETWEEN para aprovechar el indice + AND t.Factura IS NULL + AND t.Localizacion = 'RECHAZO' + AND t.PedidoImpreso = 0 + AND t.Etiquetasemitidas = 0 + AND vn2008.is_bionic(t.Id_Ticket) + AND t.Id_Cliente <> 1118 + AND t.Id_Ticket <> intTicketActual + LIMIT 1; + + IF Id_NEWTICKET IS NULL + THEN + CALL vn.ticketCreate(idC + , newFEC + , intWarehouse + , intEmpresa + , IdConsignatario + , intIdAgencia + , NULL + ,datLanding + , Id_NEWTICKET); - -- Busca un ticket existente que coincida con los parametros del nuevo pedido - - SET v_start = TIMESTAMP(newFEC); - SET v_end = TIMESTAMP(newFEC, '23:59:59'); + CALL bionic_calc_ticket(Id_NEWTICKET); + END IF; + + INSERT INTO vncontrol.inter(Id_Ticket, Id_Trabajador, state_id) + SELECT Id_NEWTICKET, SYSTEM_WORKER, s.id + FROM vn2008.state s + WHERE s.code = 'FIXING'; - SELECT Id_Ticket INTO Id_NEWTICKET - FROM vn2008.Tickets t - WHERE IdConsignatario = t.Id_Consigna - AND intWarehouse = t.warehouse_id - AND intIdAgencia = t.Id_Agencia - AND IFNULL(datLanding,-1) = IFNULL(t.Landing,-1) - AND t.Fecha BETWEEN v_start AND v_end -- uso BETWEEN para aprovechar el indice - AND t.Factura IS NULL - AND t.Localizacion = 'RECHAZO' - AND t.PedidoImpreso = 0 - AND t.Etiquetasemitidas = 0 - AND vn2008.is_bionic(t.Id_Ticket) - AND t.Id_Cliente <> 1118 - AND t.Id_Ticket <> intTicketActual - LIMIT 1; - - IF Id_NEWTICKET IS NULL - THEN - Call vn.ticketCreate( idC - , newFEC - , intWarehouse - , intEmpresa - , IdConsignatario - , intIdAgencia - , NULL - , newFEC - , Id_NEWTICKET); - - CALL bionic_calc_ticket(Id_NEWTICKET); - END IF; - - INSERT INTO vncontrol.inter(Id_Ticket, Id_Trabajador, state_id) - SELECT Id_NEWTICKET, SYSTEM_WORKER, s.id - FROM vn2008.state s - WHERE s.code = 'FIXING'; - - UPDATE Tickets SET landing = datLanding WHERE Id_Ticket = Id_NEWTICKET; - - INSERT INTO Movimientos(Id_Ticket, Id_Article, Concepte, Cantidad, Preu, Descuento) - SELECT Id_NEWTICKET, Id_Article, Concepte, Cantidad, Preu, Descuento - FROM Movimientos - WHERE Id_Movimiento = idMOV; - - SELECT LAST_INSERT_ID() INTO Id_NEWMOVIMIENTO; - - INSERT INTO Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) - SELECT Id_NEWMOVIMIENTO, Id_Componente, Valor - FROM Movimientos_componentes - WHERE Id_Movimiento = idMOV; + INSERT INTO Movimientos(Id_Ticket, Id_Article, Concepte, Cantidad, Preu, Descuento) + SELECT Id_NEWTICKET, Id_Article, Concepte, Cantidad, Preu, Descuento + FROM Movimientos + WHERE Id_Movimiento = idMOV; + + SELECT LAST_INSERT_ID() INTO Id_NEWMOVIMIENTO; + + INSERT INTO Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT Id_NEWMOVIMIENTO, Id_Componente, Valor + FROM Movimientos_componentes + WHERE Id_Movimiento = idMOV; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31158,7 +32221,7 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `msg`(IN memTXT VARCHAR(255), IN idREM INTEGER, idDES INTEGER) -BEGIN +BEGIN DECLARE last_ID INTEGER; DECLARE codDES CHAR(3); @@ -31166,8 +32229,7 @@ BEGIN INSERT INTO Mensajes(Mensaje,Fecha,Remitente,Destinatario) VALUES(memTXT, NOW(),idREM, idDES); - - SELECT LAST_INSERT_ID() INTO last_ID; + SELECT LAST_INSERT_ID() INTO last_ID; INSERT INTO Incidencias(Incidencia,Id_Trabajador,Destino,Fecha,Fecha_Mod) @@ -31191,65 +32253,52 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_brother_add`(IN strTABLE VARCHAR(45) - ,IN strBROTHER_NEW VARCHAR(45) - ,IN idBROTHER_OLD INT - ) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_brother_add`( + vTable VARCHAR(45) + ,vNewBrother VARCHAR(45) + ,vOldBrotherId INT +) BEGIN + DECLARE vMyRight INT; + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); + DROP TEMPORARY TABLE IF EXISTS aux; + CREATE TEMPORARY TABLE aux + SELECT 0 as rgt; -DECLARE v_sql TEXT; -DECLARE myRight INT; + CALL util.exec (sql_printf ( + 'UPDATE vn2008.aux SET rgt = (SELECT rgt FROM %t.%t WHERE id = %v)' + ,vSchema + ,vTable + ,vOldBrotherId + )); -DROP TEMPORARY TABLE IF EXISTS aux; -CREATE TEMPORARY TABLE aux -SELECT 0 as rgt; + SELECT rgt INTO vMyRight FROM aux; + DROP TEMPORARY TABLE aux; - - - SET v_sql = sql_printf ( - ' - UPDATE aux SET rgt = (SELECT rgt FROM %t WHERE id = %v); - ', - strTABLE, - idBROTHER_OLD); - -CALL sql_query (v_sql); - -SELECT rgt INTO myRight FROM aux; - -DROP TEMPORARY TABLE IF EXISTS aux; - - - - -SET v_sql = sql_printf ( - ' - UPDATE %t SET rgt = rgt + 2 WHERE rgt > %v ORDER BY rgt DESC; - ', - strTABLE, myRight); - -CALL sql_query (v_sql); - -SET v_sql = sql_printf ( - ' - UPDATE %t SET lft = lft + 2 WHERE lft > %v ORDER BY lft DESC; - ',strTABLE, myRight); -CALL sql_query (v_sql); - -SET v_sql = sql_printf ( - ' - INSERT INTO %t(name, lft, rgt) VALUES(%v, %v + 1, %v + 2); - ',strTABLE - ,strBROTHER_NEW - ,myRight - ,myRight); - -CALL sql_query (v_sql); - + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET rgt = rgt + 2 WHERE rgt > %v ORDER BY rgt DESC' + ,vSchema + ,vTable + ,vMyRight + )); + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET lft = lft + 2 WHERE lft > %v ORDER BY lft DESC' + ,vSchema + ,vTable + ,vMyRight + )); + CALL util.exec (sql_printf ( + 'INSERT INTO %t.%t (name, lft, rgt) VALUES(%v, %v + 1, %v + 2)' + ,vSchema + ,vTable + ,vNewBrother + ,vMyRight + ,vMyRight + )); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31266,64 +32315,52 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_child_add`(IN strTABLE VARCHAR(45) - ,IN strCHILD VARCHAR(45) - ,IN idFATHER INT - ) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_child_add`( + vTable VARCHAR(45) + ,vChild VARCHAR(45) + ,vFatherId INT +) BEGIN + DECLARE vMyLeft INT; + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); + DROP TEMPORARY TABLE IF EXISTS aux; + CREATE TEMPORARY TABLE aux + SELECT 0 as lft; -DECLARE v_sql TEXT; -DECLARE myLeft INT; + CALL util.exec (sql_printf ( + 'UPDATE vn2008.aux SET lft = (SELECT lft FROM %t.%t WHERE id = %v)' + ,vSchema + ,vTable + ,vFatherId + )); -DROP TEMPORARY TABLE IF EXISTS aux; -CREATE TEMPORARY TABLE aux -SELECT 0 as lft; + SELECT lft INTO vMyLeft FROM aux; - - - SET v_sql = sql_printf ( - ' - UPDATE aux SET lft = (SELECT lft FROM %t WHERE id = %v); - ', - strTABLE, - idFATHER); - -CALL sql_query (v_sql); + DROP TEMPORARY TABLE aux; -SELECT lft INTO myLeft FROM aux; - -DROP TEMPORARY TABLE IF EXISTS aux; - - - - -SET v_sql = sql_printf ( - ' - UPDATE %t SET rgt = rgt + 2 WHERE rgt > %v ORDER BY rgt DESC; - ', - strTABLE, myLeft); - -CALL sql_query (v_sql); - -SET v_sql = sql_printf ( - ' - UPDATE %t SET lft = lft + 2 WHERE lft > %v ORDER BY lft DESC; - ',strTABLE, myLeft); -CALL sql_query (v_sql); - -SET v_sql = sql_printf ( - ' - INSERT INTO %t(name, lft, rgt) VALUES(%v, %v + 1, %v + 2); - ',strTABLE - ,strCHILD - ,myLeft - ,myLeft); - -CALL sql_query (v_sql); - + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET rgt = rgt + 2 WHERE rgt > %v ORDER BY rgt DESC' + ,vSchema + ,vTable + ,vMyLeft + )); + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET lft = lft + 2 WHERE lft > %v ORDER BY lft DESC' + ,vSchema + ,vTable + ,vMyLeft + )); + CALL util.exec (sql_printf ( + 'INSERT INTO %t.%t(name, lft, rgt) VALUES(%v, %v + 1, %v + 2)' + ,vSchema + ,vTable + ,vChild + ,vMyLeft + ,vMyLeft + )); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31340,66 +32377,54 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_delete`(IN strTABLE VARCHAR(45) ,IN idNODE INT) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_delete`( + vTable VARCHAR(45) + ,vNodeId INT +) BEGIN + DECLARE vMyRight INT; + DECLARE vMyLeft INT; + DECLARE vMyWidth INT; + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); + DROP TEMPORARY TABLE IF EXISTS aux; + CREATE TEMPORARY TABLE aux + SELECT 0 AS rgt, 0 AS lft, 0 AS wdt; -DECLARE v_sql TEXT; -DECLARE myRight INT; -DECLARE myLeft INT; -DECLARE myWidth INT; + CALL util.exec (sql_printf ( + 'UPDATE vn2008.aux a JOIN %t.%t t SET a.rgt = t.rgt, a.lft = t.lft, a.wdt = t.rgt - t.lft + 1 WHERE t.id = %v' + ,vSchema + ,vTable + ,vNodeId + )); -DROP TEMPORARY TABLE IF EXISTS aux; -CREATE TEMPORARY TABLE aux -SELECT 0 as rgt, 0 as lft, 0 as wdt; - - - SET v_sql = sql_printf ( - ' - UPDATE aux a JOIN %t t SET a.rgt = t.rgt, a.lft = t.lft, a.wdt = t.rgt - t.lft + 1 - WHERE t.id = %v; - ', - strTABLE, - idNODE); - -CALL sql_query (v_sql); - -SELECT rgt, lft, wdt INTO myRight, myLeft, myWidth FROM aux; - -DROP TEMPORARY TABLE IF EXISTS aux; - -SET v_sql = sql_printf ( - ' - DELETE FROM %t WHERE lft BETWEEN %v AND %v - ',strTABLE - ,myLeft - ,myRight); - -CALL sql_query (v_sql); - - - -SET v_sql = sql_printf ( - ' - UPDATE %t SET rgt = rgt - %v WHERE rgt > %v ORDER BY rgt; - ',strTABLE - ,myWidth - ,myRight); - -CALL sql_query (v_sql); - -SET v_sql = sql_printf ( - ' - UPDATE %t SET lft = lft - %v WHERE lft > %v ORDER BY lft; - ',strTABLE - ,myWidth - ,myRight); - -CALL sql_query (v_sql); + SELECT rgt, lft, wdt INTO vMyRight, vMyLeft, vMyWidth FROM aux; + DROP TEMPORARY TABLE aux; + CALL util.exec (sql_printf ( + 'DELETE FROM %t.%t WHERE lft BETWEEN %v AND %v' + ,vSchema + ,vTable + ,vMyLeft + ,vMyRight + )); + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET rgt = rgt - %v WHERE rgt > %v ORDER BY rgt' + ,vSchema + ,vTable + ,vMyWidth + ,vMyRight + )); + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET lft = lft - %v WHERE lft > %v ORDER BY lft' + ,vSchema + ,vTable + ,vMyWidth + ,vMyRight + )); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31416,84 +32441,82 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_leaves`(IN strTABLE VARCHAR(20), IN strTABLE_LINES VARCHAR(40), IN strNEST_ID VARCHAR(40), IN intGAP INTEGER, IN bolSHOW BOOLEAN) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_leaves`( + vTable VARCHAR(20) + ,vLinesTable VARCHAR(40) + ,vNestId VARCHAR(40) + ,vGap INT + ,vShouldShow BOOL +) BEGIN + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); -DECLARE v_sql TEXT; + DROP TEMPORARY TABLE IF EXISTS tmp.nest; - -DROP TEMPORARY TABLE IF EXISTS tmp.nest; - --- Se llama al procedimiento que genera el arbol -CALL nest_tree(strTABLE, intGAP, FALSE); - --- Se añade un campo para el conteo de hojas -ALTER TABLE tmp.nest -ADD leaves INT, -ADD time DATETIME; - --- Añadimos la hora -SET v_sql = sql_printf ( - ' - update tmp.nest n - join vn2008.%t s using(id) - set n.time = s.odbc_date ; - ', strTABLE - ); - - -CALL sql_query (v_sql); - - --- Actualizamos el campo leaves para los nodos que tienen asociados -SET v_sql = sql_printf ( - ' - update tmp.nest n - join - ( - select %t as id, count(*) as leaves - from vn2008.%t - group by %t - ) s using(id) - set n.leaves = s.leaves - ; - ', strNEST_ID - , strTABLE_LINES - , strNEST_ID - ); - - -CALL sql_query (v_sql); - --- Actualizamos todos los nodos con la suma de las hojas de los hijos -drop temporary table if exists tmp.nest2; - -create temporary table tmp.nest2 -select * from tmp.nest; - -drop temporary table if exists tmp.nest3; - -create temporary table tmp.nest3 -select * from tmp.nest; - -update tmp.nest -join -( -select n.id, sum(n2.leaves) leaves -from tmp.nest3 n -join tmp.nest2 n2 on n2.lft between n.lft and n.rgt -group by n.id -) sub on sub.id = nest.id -set nest.leaves = ifnull(sub.leaves,0); - - -drop temporary table tmp.nest2; - -IF bolSHOW THEN - SELECT * FROM tmp.nest; -END IF; + -- Se llama al procedimiento que genera el arbol + CALL nest_tree(vTable, vGap, FALSE); + -- Se añade un campo para el conteo de hojas + + ALTER TABLE tmp.nest + ADD leaves INT, + ADD time DATETIME; + + -- Añadimos la hora + + CALL util.exec (sql_printf ( + 'UPDATE tmp.nest n + JOIN %t.%t s using(id) + SET n.time = s.odbc_date' + ,vSchema + ,vTable + )); + + -- Actualizamos el campo leaves para los nodos que tienen asociados + + CALL util.exec (sql_printf ( + 'update tmp.nest n + join + ( + select %t as id, count(*) as leaves + from %t.%t + group by %t + ) s using(id) + set n.leaves = s.leaves' + ,vNestId + ,vSchema + ,vLinesTable + ,vNestId + )); + + -- Actualizamos todos los nodos con la suma de las hojas de los hijos + + drop temporary table if exists tmp.nest2; + + create temporary table tmp.nest2 + select * from tmp.nest; + + drop temporary table if exists tmp.nest3; + + create temporary table tmp.nest3 + select * from tmp.nest; + + update tmp.nest + join + ( + select n.id, sum(n2.leaves) leaves + from tmp.nest3 n + join tmp.nest2 n2 on n2.lft between n.lft and n.rgt + group by n.id + ) sub on sub.id = nest.id + set nest.leaves = ifnull(sub.leaves,0); + + drop temporary table tmp.nest2; + + IF vShouldShow THEN + SELECT * FROM tmp.nest; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31510,131 +32533,113 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_move`(IN strTABLE VARCHAR(45) ,IN idNODE INT, IN idFATHER INT) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_move`( + strTABLE VARCHAR(45) + ,idNODE INT + ,idFATHER INT +) BEGIN + DECLARE myRight INT; + DECLARE myLeft INT; + DECLARE myWidth INT; + DECLARE fatherRight INT; + DECLARE fatherLeft INT; + DECLARE gap INT; + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); + DROP TEMPORARY TABLE IF EXISTS aux; + CREATE TEMPORARY TABLE aux + SELECT 0 as rgt, 0 as lft, 0 as wdt, 0 as frg, 0 as flf; -DECLARE v_sql TEXT; -DECLARE myRight INT; -DECLARE myLeft INT; -DECLARE myWidth INT; -DECLARE fatherRight INT; -DECLARE fatherLeft INT; -DECLARE gap INT; + -- Averiguamos el ancho de la rama -DROP TEMPORARY TABLE IF EXISTS aux; -CREATE TEMPORARY TABLE aux -SELECT 0 as rgt, 0 as lft, 0 as wdt, 0 as frg, 0 as flf; + CALL util.exec (sql_printf ( + 'UPDATE vn2008.aux a JOIN %t.%t t SET a.wdt = t.rgt - t.lft +1 + WHERE t.id = %v' + ,vSchema + ,strTABLE + ,idNODE + )); + -- Averiguamos la posicion del nuevo padre - - -- Averiguamos el ancho de la rama - SET v_sql = sql_printf ( - ' - UPDATE aux a JOIN %t t SET a.wdt = t.rgt - t.lft +1 - WHERE t.id = %v; - ', - strTABLE, - idNODE); - -CALL sql_query (v_sql); + CALL util.exec (sql_printf ( + 'UPDATE vn2008.aux a JOIN %t.%t t SET a.frg = t.rgt, a.flf = t.lft WHERE t.id = %v' + ,vSchema + ,strTABLE + ,idFATHER + )); --- Averiguamos la posicion del nuevo padre - SET v_sql = sql_printf ( - ' - UPDATE aux a JOIN %t t SET a.frg = t.rgt, a.flf = t.lft - WHERE t.id = %v; - ', - strTABLE, - idFATHER); - -CALL sql_query (v_sql); + SELECT wdt, frg, flf INTO myWidth, fatherRight, fatherLeft FROM aux; -SELECT wdt, frg, flf INTO myWidth, fatherRight, fatherLeft FROM aux; + -- 1º Incrementamos los valores de todos los nodos a la derecha del punto de inserción (fatherRight) , para hacer sitio + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET rgt = rgt + %v WHERE rgt >= %v ORDER BY rgt DESC' + ,vSchema + ,strTABLE + ,myWidth + ,fatherRight + )); --- 1º Incrementamos los valores de todos los nodos a la derecha del punto de inserción (fatherRight) , para hacer sitio + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET lft = lft + %v WHERE lft >= %v ORDER BY lft DESC' + ,vSchema + ,strTABLE + ,myWidth + ,fatherRight + )); + -- Es preciso recalcular los valores del nodo en el caso de que estuviera a la derecha del nuevo padre -SET v_sql = sql_printf ( - ' - UPDATE %t SET rgt = rgt + %v WHERE rgt >= %v ORDER BY rgt DESC; - ',strTABLE - ,myWidth - ,fatherRight); - -CALL sql_query (v_sql); + CALL util.exec (sql_printf ( + 'UPDATE vn2008.aux a JOIN %t.%t t SET a.rgt = t.rgt, a.lft = t.lft WHERE t.id = %v' + ,vSchema + ,strTABLE + ,idNODE + )); -SET v_sql = sql_printf ( - ' - UPDATE %t SET lft = lft + %v WHERE lft >= %v ORDER BY lft DESC; - ',strTABLE - ,myWidth - ,fatherRight); - -CALL sql_query (v_sql); + SELECT lft, rgt, frg - lft INTO myLeft, myRight, gap FROM aux; --- Es preciso recalcular los valores del nodo en el caso de que estuviera a la derecha del nuevo padre + -- 2º Incrementamos el valor de todos los nodos a trasladar hasta alcanzar su nueva posicion -SET v_sql = sql_printf ( - ' - UPDATE aux a JOIN %t t SET a.rgt = t.rgt, a.lft = t.lft - WHERE t.id = %v; - ', - strTABLE, - idNODE); - -CALL sql_query (v_sql); + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET lft = lft + %v WHERE lft BETWEEN %v AND %v ORDER BY lft DESC' + ,vSchema + ,strTABLE + ,gap + ,myLeft + ,myRight + )); -SELECT lft, rgt, frg - lft INTO myLeft, myRight, gap FROM aux; + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET rgt = rgt + %v WHERE rgt BETWEEN %v AND %v ORDER BY rgt DESC' + ,vSchema + ,strTABLE + ,gap + ,myLeft + ,myRight + )); + -- 3º Restaremos a todos los nodos resultantes, a la derecha de la posicion arrancada el ancho de la rama escindida --- 2º Incrementamos el valor de todos los nodos a trasladar hasta alcanzar su nueva posicion + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET lft = lft - %v WHERE lft > %v ORDER BY lft' + ,vSchema + ,strTABLE + ,myWidth + ,myLeft + )); + CALL util.exec (sql_printf ( + 'UPDATE %t.%t SET rgt = rgt - %v WHERE rgt > %v ORDER BY rgt' + ,vSchema + ,strTABLE + ,myWidth + ,myRight + )); -SET v_sql = sql_printf ( - ' - UPDATE %t SET lft = lft + %v WHERE lft BETWEEN %v AND %v ORDER BY lft DESC; - ',strTABLE - ,gap - ,myLeft - ,myRight); - -CALL sql_query (v_sql); - -SET v_sql = sql_printf ( - ' - UPDATE %t SET rgt = rgt + %v WHERE rgt BETWEEN %v AND %v ORDER BY rgt DESC; - ',strTABLE - ,gap - ,myLeft - ,myRight); - -CALL sql_query (v_sql); - --- 3º Restaremos a todos los nodos resultantes, a la derecha de la posicion arrancada el ancho de la rama escindida -SET v_sql = sql_printf ( - ' - UPDATE %t SET lft = lft - %v WHERE lft > %v ORDER BY lft; - ',strTABLE - ,myWidth - ,myLeft); - -CALL sql_query (v_sql); - - -SET v_sql = sql_printf ( - ' - UPDATE %t SET rgt = rgt - %v WHERE rgt > %v ORDER BY rgt; - ',strTABLE - ,myWidth - ,myRight); - -CALL sql_query (v_sql); - - -DROP TEMPORARY TABLE IF EXISTS aux; - + DROP TEMPORARY TABLE aux; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31651,176 +32656,142 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_query`(IN strTABLE VARCHAR(45)) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_query`(strTABLE VARCHAR(45)) BEGIN + DECLARE v_max_depth INT; + DECLARE v_current_depth INT; + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); + DROP TEMPORARY TABLE IF EXISTS tmp.nest_depth; + DROP TEMPORARY TABLE IF EXISTS tmp.nest_depth_aux; -DECLARE v_sql TEXT; -DECLARE v_max_depth INT; -DECLARE v_current_depth INT; + -- Calculamos el nivel de profundidad para cada item -DROP TEMPORARY TABLE IF EXISTS tmp.nest_depth; -DROP TEMPORARY TABLE IF EXISTS tmp.nest_depth_aux; - - --- Calculamos el nivel de profundidad para cada item -SET v_sql = sql_printf ( - ' - CREATE TEMPORARY TABLE tmp.nest_depth - - SELECT node.id node_id, COUNT(parent.id) - 1 as depth - FROM %t AS node, - %t AS parent + CALL util.exec (sql_printf ( + 'CREATE TEMPORARY TABLE tmp.nest_depth + SELECT node.id node_id, COUNT(parent.id) - 1 as depth + FROM %t.%t AS node, + %t.%t AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt GROUP BY node.id - ORDER BY node.lft - ; - ', - strTABLE, - strTABLE - ); - - -CALL sql_query (v_sql); - -SELECT max(depth) FROM tmp.nest_depth INTO v_max_depth; -SET v_current_depth = 2; + ORDER BY node.lft' + ,vSchema + ,strTABLE + ,vSchema + ,strTABLE + )); -CREATE TEMPORARY TABLE tmp.nest_depth_aux -SELECT * FROM tmp.nest_depth; + SELECT max(depth) FROM tmp.nest_depth INTO v_max_depth; + SET v_current_depth = 2; + CREATE TEMPORARY TABLE tmp.nest_depth_aux + SELECT * FROM tmp.nest_depth; --- Vamos a hacer consultas anidadas para obtener una consulta de dos entradas + -- Vamos a hacer consultas anidadas para obtener una consulta de dos entradas -DROP TEMPORARY TABLE IF EXISTS tmp.nest; -DROP TEMPORARY TABLE IF EXISTS tmp.nest_aux; + DROP TEMPORARY TABLE IF EXISTS tmp.nest; + DROP TEMPORARY TABLE IF EXISTS tmp.nest_aux; - --- Primera tabla, con el nivel 0 -SET v_sql = sql_printf ( - ' - CREATE TEMPORARY TABLE tmp.nest - SELECT child.id nest_id - ,child.lft - ,child.rgt - ,parent.id as ID0 - ,parent.name as PARENT0 - ,child.id as ID1 - ,child.name as PARENT1 - FROM %t AS parent - JOIN tmp.nest_depth nd ON nd.node_id = parent.id AND nd.depth = 0, - %t AS child - JOIN tmp.nest_depth_aux ndc ON ndc.node_id = child.id AND ndc.depth = 1 + -- Primera tabla, con el nivel 0 + CALL util.exec (sql_printf ( + 'CREATE TEMPORARY TABLE tmp.nest + SELECT child.id nest_id + ,child.lft + ,child.rgt + ,parent.id as ID0 + ,parent.name as PARENT0 + ,child.id as ID1 + ,child.name as PARENT1 + FROM %t.%t AS parent + JOIN tmp.nest_depth nd ON nd.node_id = parent.id AND nd.depth = 0, + %t.%t AS child + JOIN tmp.nest_depth_aux ndc ON ndc.node_id = child.id AND ndc.depth = 1 WHERE child.lft BETWEEN parent.lft + 1 AND parent.rgt - ORDER BY parent.lft; - ', - strTABLE, - strTABLE - ); - -CALL sql_query (v_sql); + ORDER BY parent.lft' + ,vSchema + ,strTABLE + ,vSchema + ,strTABLE + )); -CREATE TEMPORARY TABLE tmp.nest_aux -SELECT * FROM tmp.nest; - - - --- Bucle -WHILE v_current_depth <= v_max_depth DO - - - DROP TEMPORARY TABLE IF EXISTS tmp.nest; - - SET v_sql = sql_printf ( - ' - CREATE TEMPORARY TABLE tmp.nest - SELECT parent.* - ,child.id as %v - ,child.name as %v - ,child.id as ID - FROM tmp.nest_aux AS parent - LEFT JOIN %t AS child ON child.lft BETWEEN parent.lft + 1 AND parent.rgt - LEFT JOIN tmp.nest_depth_aux ndc ON ndc.node_id = child.id - WHERE IFNULL(ndc.depth,%v) = %v - ORDER BY parent.lft; - ' - ,CONCAT('ID',v_current_depth) - ,CONCAT('PARENT',v_current_depth) - ,strTABLE - ,v_current_depth - ,v_current_depth - ); - - CALL sql_query (v_sql); - --- Actualizamos lft y rgt -SET v_sql = sql_printf ( - ' - UPDATE tmp.nest - JOIN %t AS child ON child.id = nest.ID - SET nest.lft = child.lft, nest.rgt = child.rgt, nest_id = nest.ID' - ,strTABLE - ); - -CALL sql_query (v_sql); - - - - ALTER TABLE tmp.nest DROP COLUMN ID; - - DROP TEMPORARY TABLE IF EXISTS tmp.nest_aux; - CREATE TEMPORARY TABLE tmp.nest_aux + CREATE TEMPORARY TABLE tmp.nest_aux SELECT * FROM tmp.nest; + WHILE v_current_depth <= v_max_depth + DO + DROP TEMPORARY TABLE IF EXISTS tmp.nest; + CALL util.exec (sql_printf ( + 'CREATE TEMPORARY TABLE tmp.nest + SELECT parent.* + ,child.id as %v + ,child.name as %v + ,child.id as ID + FROM tmp.nest_aux AS parent + LEFT JOIN %t.%t AS child ON child.lft BETWEEN parent.lft + 1 AND parent.rgt + LEFT JOIN tmp.nest_depth_aux ndc ON ndc.node_id = child.id + WHERE IFNULL(ndc.depth,%v) = %v + ORDER BY parent.lft' + ,CONCAT('ID',v_current_depth) + ,CONCAT('PARENT',v_current_depth) + ,vSchema + ,strTABLE + ,v_current_depth + ,v_current_depth + )); + + -- Actualizamos lft y rgt + + CALL util.exec (sql_printf ( + 'UPDATE tmp.nest + JOIN %t.%t AS child ON child.id = nest.ID + SET nest.lft = child.lft, nest.rgt = child.rgt, nest_id = nest.ID' + ,vSchema + ,strTABLE + )); + + ALTER TABLE tmp.nest DROP COLUMN ID; + + DROP TEMPORARY TABLE IF EXISTS tmp.nest_aux; + CREATE TEMPORARY TABLE tmp.nest_aux + SELECT * FROM tmp.nest; + + SET v_current_depth = v_current_depth + 1; + END WHILE; + + -- Eliminamos los campos duplicados + SET v_current_depth = 0; + + WHILE v_current_depth <= v_max_depth + DO + SET @id = 0; + + CALL util.exec (sql_printf ( + 'UPDATE tmp.nest_aux + SET %t = IF(@id = %t, NULL, %t), + ID0 = IF(@id := %t, ID0, ID0), + %t = IF(length(%t), %t,NULL)' + ,CONCAT('PARENT',v_current_depth) + ,CONCAT('ID',v_current_depth) + ,CONCAT('PARENT',v_current_depth) + ,CONCAT('ID',v_current_depth) + ,CONCAT('ID',v_current_depth) + ,CONCAT('PARENT',v_current_depth) + ,CONCAT('ID',v_current_depth) + )); SET v_current_depth = v_current_depth + 1; + END WHILE; -END WHILE; + SELECT * FROM tmp.nest_aux; + -- Limpieza - --- Eliminamos los campos duplicados -SET v_current_depth = 0; - -WHILE v_current_depth <= v_max_depth DO - - SET @id = 0; - - SET v_sql = sql_printf ( - ' - UPDATE tmp.nest_aux - SET %t = IF(@id = %t, NULL, %t), - ID0 = IF(@id := %t, ID0, ID0), - %t = IF(length(%t), %t,NULL) - ' - ,CONCAT('PARENT',v_current_depth) - ,CONCAT('ID',v_current_depth) - ,CONCAT('PARENT',v_current_depth) - ,CONCAT('ID',v_current_depth) - ,CONCAT('ID',v_current_depth) - ,CONCAT('PARENT',v_current_depth) - ,CONCAT('ID',v_current_depth) - ); - - CALL sql_query (v_sql); - - SET v_current_depth = v_current_depth + 1; - -END WHILE; - - - - -SELECT * FROM tmp.nest_aux; - - --- Limpieza -DROP TEMPORARY TABLE IF EXISTS tmp.nest_aux; -DROP TEMPORARY TABLE IF EXISTS tmp.nest; -DROP TEMPORARY TABLE IF EXISTS tmp.nest_depth_aux; -DROP TEMPORARY TABLE IF EXISTS tmp.nest_depth; - + DROP TEMPORARY TABLE IF EXISTS + tmp.nest_aux, + tmp.nest, + tmp.nest_depth_aux, + tmp.nest_depth; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31837,50 +32808,36 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_sons_list`(IN intID INT, IN strTABLE VARCHAR(45), IN bolSHOW BOOLEAN) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_sons_list`( + vId INT + ,vTable VARCHAR(45) + ,vShouldShow BOOLEAN +) BEGIN +/** + * Devuelve un recordset con los ID de todos los nodos que + * cuelgan del nodo que se pasa como parámetro + */ + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); - -/* - -Esta función devuelve un recordset con los ID de todos los nodos que cuelgan del nodo que se pasa como parámetro - -*/ - - -DECLARE v_sql TEXT; - -DROP TEMPORARY TABLE IF EXISTS tmp.nest_sons; - - -SET v_sql = sql_printf ( - ' - CREATE TEMPORARY TABLE tmp.nest_sons - - SELECT DISTINCT node.id node_id - FROM %t AS node - JOIN %t AS parent ON node.lft between parent.lft and parent.rgt + DROP TEMPORARY TABLE IF EXISTS tmp.nest_sons; + CALL util.exec (sql_printf ( + 'CREATE TEMPORARY TABLE tmp.nest_sons + SELECT DISTINCT node.id node_id + FROM %t.%t AS node + JOIN %t.%t AS parent ON node.lft between parent.lft and parent.rgt WHERE parent.id = %v - ORDER BY node.lft - ; - ', - strTABLE, - strTABLE, - intID - ); - - -CALL sql_query (v_sql); + ORDER BY node.lft' + ,vSchema + ,vTable + ,vSchema + ,vTable + ,vId + )); -IF bolSHOW THEN - - SELECT * FROM tmp.nest_sons; - -END IF; - - - - + IF vShouldShow THEN + SELECT * FROM tmp.nest_sons; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31897,42 +32854,38 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nest_tree`(IN strTABLE VARCHAR(20), IN intGAP INTEGER, IN bolSHOW BOOLEAN) +CREATE DEFINER=`root`@`%` PROCEDURE `nest_tree`( + vTable VARCHAR(20) + ,vGap INT + ,vShouldShow BOOL +) BEGIN + DECLARE vSchema VARCHAR(255) DEFAULT SCHEMA(); -DECLARE v_sql TEXT; - - -DROP TEMPORARY TABLE IF EXISTS tmp.nest; - -SET v_sql = sql_printf ( - ' - CREATE TEMPORARY TABLE tmp.nest - SELECT node.id - , CONCAT( REPEAT(REPEAT(" ",%v), COUNT(parent.id) - 1), node.name) AS name - , node.lft - , node.rgt - , COUNT(parent.id) - 1 as depth - , cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons - FROM %t AS node, - %t AS parent + DROP TEMPORARY TABLE IF EXISTS tmp.nest; + CALL util.exec (sql_printf ( + 'CREATE TEMPORARY TABLE tmp.nest + SELECT node.id + ,CONCAT( REPEAT(REPEAT(" ",%v), COUNT(parent.id) - 1), node.name) AS name + ,node.lft + ,node.rgt + ,COUNT(parent.id) - 1 as depth + ,cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons + FROM %t.%t AS node, + %t.%t AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt GROUP BY node.id - ORDER BY node.lft; - ', - intGAP, - strTABLE, - strTABLE - ); - - -CALL sql_query (v_sql); - -IF bolSHOW THEN - SELECT * FROM tmp.nest; -END IF; - + ORDER BY node.lft' + ,vGap + ,vSchema + ,vTable + ,vSchema + ,vTable + )); + IF vShouldShow THEN + SELECT * FROM tmp.nest; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31996,52 +32949,52 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `niching`(IN i_ini INT, IN i_end INT +CREATE DEFINER=`root`@`%` PROCEDURE `niching`(IN i_ini INT, IN i_end INT , IN i_bal INT, IN i_col INT ) -BEGIN - -DECLARE i INT(5); -DECLARE j INT(5); - -DROP TEMPORARY TABLE IF EXISTS labels; - -CREATE TEMPORARY TABLE `labels` - (`label` VARCHAR(15) NULL) -ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -WHILE i_ini <= i_end DO - - SET i = i_bal; - - WHILE i > 0 DO - - - - SET j = i_col; - IF j = 0 THEN - INSERT INTO labels(label) - VALUES (CONCAT(i_ini,IF(i=0,' ',char(64 + i)))); - ELSE - - WHILE j > 0 DO - - INSERT INTO labels(label) - VALUES (CONCAT(i_ini,char(64 + i), j)); - - SET j = j - 1; - - END WHILE; - END IF; - SET i = i - 1; - - END WHILE; - -SET i_ini = i_ini + 1; - -END WHILE; - -SELECT CONCAT('*',label,'*') as label, label as id FROM labels; - +BEGIN + +DECLARE i INT(5); +DECLARE j INT(5); + +DROP TEMPORARY TABLE IF EXISTS labels; + +CREATE TEMPORARY TABLE `labels` + (`label` VARCHAR(15) NULL) +ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +WHILE i_ini <= i_end DO + + SET i = i_bal; + + WHILE i > 0 DO + + + + SET j = i_col; + IF j = 0 THEN + INSERT INTO labels(label) + VALUES (CONCAT(i_ini,IF(i=0,' ',char(64 + i)))); + ELSE + + WHILE j > 0 DO + + INSERT INTO labels(label) + VALUES (CONCAT(i_ini,char(64 + i), j)); + + SET j = j - 1; + + END WHILE; + END IF; + SET i = i - 1; + + END WHILE; + +SET i_ini = i_ini + 1; + +END WHILE; + +SELECT CONCAT('*',label,'*') as label, label as id FROM labels; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32290,7 +33243,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `percentil`() BEGIN DECLARE max_range INT; - + DROP TEMPORARY TABLE IF EXISTS previa; CREATE TEMPORARY TABLE previa @@ -32305,14 +33258,14 @@ AND YEAR(Fecha) = YEAR(CURDATE()) GROUP BY Id_Cliente) sub ORDER BY Total ) sub2; - + SELECT COUNT(*) INTO max_range FROM previa; UPDATE Clientes SET percentil = 0; UPDATE Clientes INNER JOIN previa USING(Id_Cliente) SET Clientes.percentil = ROUND(Posicion *100 / max_range,0); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32381,10 +33334,10 @@ BEGIN SELECT price price FROM Agencias_zonas az INNER JOIN viaxpress USING(zona) WHERE Id_Agencia = 47 AND codigo_postal = strCodPostal AND az.warehouse_id = intWarehouse_id; ELSE - CALL sql_query (sql_printf (' - SELECT price FROM Agencias_zonas az + CALL util.exec (sql_printf (' + SELECT price FROM vn2008.Agencias_zonas az WHERE Id_Agencia = %v AND %v = Id_Article AND az.warehouse_id = %v - AND zona = (SELECT zona FROM Agencias_province + AND zona = (SELECT zona FROM vn2008.Agencias_province WHERE warehouse_id = %v AND agency_id = %v and province_id = %v)' ,intId_Agencia,intId_Article,intWarehouse_id,intWarehouse_id,int_agency_id,int_province_id)); END IF; @@ -32674,13 +33627,13 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `proc_end`() -BEGIN - -UPDATE stat SET `end` = NOW() -WHERE id = (SELECT id FROM lastid); - -DROP TEMPORARY TABLE IF EXISTS lastid; - +BEGIN + +UPDATE stat SET `end` = NOW() +WHERE id = (SELECT id FROM lastid); + +DROP TEMPORARY TABLE IF EXISTS lastid; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -32698,14 +33651,48 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `proc_start`(IN v_proc_id INT) +BEGIN + +INSERT INTO stat(proc_id) VALUES(v_proc_id); + + +DROP TEMPORARY TABLE IF EXISTS lastid; +CREATE TEMPORARY TABLE lastid +SELECT last_insert_id() id; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `productionState` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-developer`@`%` PROCEDURE `productionState`(vWarehouse INT , vDate DATE) BEGIN -INSERT INTO stat(proc_id) VALUES(v_proc_id); - -DROP TEMPORARY TABLE IF EXISTS lastid; -CREATE TEMPORARY TABLE lastid -SELECT last_insert_id() id; +SELECT IF(a.Vista= 2, z.alias, a.Agencia) Agencia, t.Id_Ruta, count(*) Pedidos +FROM Tickets t +JOIN Consignatarios CS on CS.Id_Consigna = t.Id_Consigna +JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia + LEFT JOIN Agencias_province ap on ap.province_id = CS.province_id AND ap.warehouse_id = t.warehouse_id AND ap.agency_id = a.agency_id + LEFT JOIN Tickets_state tls on tls.Id_Ticket = t.Id_Ticket + LEFT JOIN zoneNickname z ON z.warehouse_id = ap.warehouse_id and z.agency_id = ap.agency_id AND z.zona = ap.zona + LEFT JOIN vncontrol.inter vni ON vni.inter_id = tls.inter_id + LEFT JOIN state s ON s.id = vni.state_id +WHERE Fecha BETWEEN vDate AND util.dayend(vDate) +AND s.alert_level = 1 +AND t.warehouse_id = vWarehouse +GROUP BY Agencia, Id_Ruta; END ;; DELIMITER ; @@ -33123,8 +34110,9 @@ BEGIN DECLARE vMidnight DATETIME DEFAULT TIMESTAMP(CURDATE(),'23:59:59'); DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,vMidnight); DECLARE SAFE_ALERT_LEVEL INT DEFAULT 3; + DECLARE vLoadingDelay DECIMAL(5) DEFAULT 2; - CALL prepare_ticket_list(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + CALL prepare_ticket_list(TIMESTAMPADD(DAY,0,CURDATE()-1), vEndingDate); CALL prepare_client_list; CALL production_buffer_problems; @@ -33138,14 +34126,15 @@ BEGIN , t.Alias , t.Bultos , HOUR(t.Fecha) as Hora - , HOUR(t.Fecha) as Departure + , HOUR(t.Fecha) + vLoadingDelay as Departure + , MINUTE(t.Fecha) as minuto , t.Id_Ruta , IF(a.Vista = 2,ap.zona,0) as zona , CS.Consignatario , CS.CODPOSTAL , CS.POBLACION , p.name PROVINCIA - , IF(a.Vista= 2, CONCAT('ZONA ',ap.zona), a.Agencia) Agencia + , IF(a.Vista= 2, CONCAT(LEFT(z.alias,16),' ',IFNULL(RIGHT(t.Id_Ruta,3),'')), a.Agencia) Agencia , a.agency_id , 0 AS `lines` , CAST( 0 AS DECIMAL(5,2)) AS m3 @@ -33162,11 +34151,12 @@ BEGIN FROM tmp.ticket_list tt JOIN Tickets t on tt.Id_Ticket = t.Id_Ticket JOIN Consignatarios CS on CS.Id_Consigna = t.Id_Consigna - JOIN province p on p.province_id = CS.province_id + LEFT JOIN province p on p.province_id = CS.province_id JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia LEFT JOIN Agencias_province ap on ap.province_id = CS.province_id AND ap.warehouse_id = t.warehouse_id AND ap.agency_id = a.agency_id LEFT JOIN vn.ticketState tls on tls.ticket = tt.Id_Ticket LEFT JOIN Trabajadores w on w.Id_Trabajador = tls.worker + LEFT JOIN zoneNickname z ON z.warehouse_id = ap.warehouse_id and z.agency_id = ap.agency_id AND z.zona = ap.zona WHERE t.warehouse_id = vWarehouseId AND a.Vista IN (1,2,3); @@ -33275,7 +34265,7 @@ BEGIN -- Refresca la caché para el cierre dinámico de agencias - CALL cache.departure_timing; + CALL cache.departure_timing(vWarehouseId); -- Tickets de recogida @@ -33318,7 +34308,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `proveedores_extracto` */; +/*!50003 DROP PROCEDURE IF EXISTS `production_control_source_Beta` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -33328,176 +34318,245 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `proveedores_extracto`(IN idPROV INT, IN idMONEDA INT, IN idEMP INT) +CREATE DEFINER=`root`@`%` PROCEDURE `production_control_source_Beta`(vWarehouseId INT, vScopeDays TINYINT) BEGIN + DECLARE vMidnight DATETIME DEFAULT TIMESTAMP(CURDATE(),'23:59:59'); + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,vMidnight); + DECLARE SAFE_ALERT_LEVEL INT DEFAULT 3; + DECLARE vLoadingDelay DECIMAL(5) DEFAULT 2; - -SET @saldo_eur:= 0; -SET @saldo_div:= 0; - -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 - 'R', - NULL as banco_id, - r.empresa_id, - r.serie, - r.id, - r.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 - 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 = idPROV - AND idMONEDA IN (r.moneda_id, 0) - AND idEMP IN (r.empresa_id,0) - GROUP BY r.id - - - - UNION ALL SELECT - - 'P', - p.id_banco, - p.empresa_id, - NULL, - p.id, - 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, - IFNULL(conciliado, 0), - Moneda, - pago_sdc_id - 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 = idPROV - AND idMONEDA IN (p.id_moneda,0) - AND idEMP IN (p.empresa_id,0) - ) AS SUB - ORDER BY fecha) t; + CALL prepare_ticket_list(TIMESTAMPADD(DAY,0,CURDATE()-1), vEndingDate); + CALL prepare_client_list; + CALL production_buffer_problems; -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 DROP PROCEDURE IF EXISTS `proveedores_extracto_vtos` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `proveedores_extracto_vtos`(IN idPROV INT, IN idMONEDA INT, IN idEMP INT) -BEGIN - - -SET @saldo_eur:= 0; -SET @saldo_div:= 0; - -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 - 'V', - NULL as banco_id, - r.empresa_id, - r.serie, - r.id, - rv.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 - 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 = idPROV - AND idMONEDA IN (r.moneda_id, 0) - AND idEMP IN (r.empresa_id,0) - GROUP BY rv.id - - - - UNION ALL SELECT - - 'P', - p.id_banco, - p.empresa_id, - NULL, - p.id, - 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, - IFNULL(conciliado, 0), - Moneda, - pago_sdc_id - 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 = idPROV - AND idMONEDA IN (p.id_moneda,0) - AND idEMP IN (p.empresa_id,0) - ) AS SUB - ORDER BY fecha, id) t; + IF vWarehouseId = 0 THEN + DELETE tt.* + FROM tmp.ticket_list tt + JOIN Tickets t on tt.Id_Ticket = t.Id_Ticket + WHERE t.warehouse_id NOT IN (1,44); + + ELSE + + DELETE tt.* + FROM tmp.ticket_list tt + JOIN Tickets t on tt.Id_Ticket = t.Id_Ticket + WHERE t.warehouse_id != vWarehouseId; + + END IF; + + /* + DROP TEMPORARY TABLE IF EXISTS tmp.selectedWarehouses; + + IF vWarehouseId = 0 THEN + + CREATE TEMPORARY TABLE tmp.selectedWarehouses + (PRIMARY KEY(id)) + ENGINE = MEMORY + SELECT id + FROM warehouse + WHERE id = vWarehouseId; + + ELSE + + CREATE TEMPORARY TABLE tmp.selectedWarehouses + (PRIMARY KEY(id)) + ENGINE = MEMORY + SELECT id + FROM warehouse + WHERE id IN (1,44); -- Silla FV y Silla PCA + + END IF; + */ + + + DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; + CREATE TEMPORARY TABLE tmp.production_buffer + (PRIMARY KEY(Id_Ticket)) + ENGINE = MEMORY + SELECT t.Id_Ticket + , t.Id_Cliente + , t.warehouse_id + , t.Alias + , t.Bultos + , HOUR(t.Fecha) as Hora + , HOUR(t.Fecha) + vLoadingDelay as Departure + , MINUTE(t.Fecha) as minuto + , t.Id_Ruta + , IF(a.Vista = 2,ap.zona,0) as zona + , CS.Consignatario + , CS.CODPOSTAL + , CS.POBLACION + , p.name PROVINCIA + , IF(a.Vista= 2, CONCAT(LEFT(z.alias,16),' ',IFNULL(RIGHT(t.Id_Ruta,3),'')), a.Agencia) Agencia + , a.agency_id + , 0 AS `lines` + , CAST( 0 AS DECIMAL(5,2)) AS m3 + , 0 AS problems + , " " as problem + , IFNULL(tls.state,2) AS state + , w.Codigotrabajador + , DATE(t.Fecha) AS Fecha + , Averiguar_ComercialCliente_IdTicket(t.Id_Ticket) AS Comercial + , p.province_id + , tls.productionOrder as state_order + , ifnull(tls.alertLevel,0) alert_level + , t.boxed as palletized + FROM tmp.ticket_list tt + JOIN Tickets t on tt.Id_Ticket = t.Id_Ticket + JOIN Consignatarios CS on CS.Id_Consigna = t.Id_Consigna + LEFT JOIN province p on p.province_id = CS.province_id + JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia + LEFT JOIN Agencias_province ap on ap.province_id = CS.province_id AND ap.warehouse_id = t.warehouse_id AND ap.agency_id = a.agency_id + LEFT JOIN vn.ticketState tls on tls.ticket = tt.Id_Ticket + LEFT JOIN Trabajadores w on w.Id_Trabajador = tls.worker + LEFT JOIN zoneNickname z ON z.warehouse_id = ap.warehouse_id and z.agency_id = ap.agency_id AND z.zona = ap.zona + AND a.Vista IN (1,2,3); + + + -- Líneas y volumen por ticket + + UPDATE tmp.production_buffer pb + JOIN ( + SELECT m.Id_Ticket, COUNT(Id_Movimiento) as `lines`, cast( sum( m.Cantidad * r.cm3 / 1000000 ) as decimal(10,2)) as m3 + FROM tmp.ticket_list tt + JOIN Tickets t ON t.Id_Ticket = tt.Id_Ticket + JOIN Movimientos m on tt.Id_Ticket = m.Id_Ticket + JOIN bi.rotacion r on m.Id_Article = r.Id_Article AND r.warehouse_id = t.warehouse_id + GROUP BY m.Id_Ticket + ) m on m.Id_Ticket = pb.Id_Ticket + SET pb.`lines` = m.`lines`, + pb.m3 = m.m3; + + DELETE FROM tmp.production_buffer + WHERE `lines`= 0; + + -- Cajas + + ALTER TABLE tmp.production_buffer + ADD Cajas DOUBLE DEFAULT NULL; + + UPDATE tmp.production_buffer pb + JOIN ( + SELECT t.Id_Ticket, sum(floor(m.Cantidad / c.Packing) * bultoCubico) as Cajas + FROM tmp.ticket_list tt + JOIN Tickets t on tt.Id_Ticket = t.Id_Ticket + JOIN Movimientos m on m.Id_Ticket = t.Id_Ticket + JOIN cache.last_buy lb on lb.warehouse_id = t.warehouse_id AND lb.item_id = m.Id_Article + JOIN Compres c on c.Id_Compra = lb.buy_id + JOIN Cubos cb on cb.Id_Cubo = c.Id_Cubo + WHERE m.Cantidad > c.Packing + GROUP BY t.Id_Ticket + HAVING Cajas >= 1 + ) sub ON sub.Id_Ticket = pb.Id_Ticket + SET pb.Cajas = sub.Cajas; + + -- Artificial, Seco y Preservado: Reino 4 + + ALTER TABLE tmp.production_buffer + ADD lineasArtificial INT DEFAULT NULL; + + UPDATE tmp.production_buffer pb + JOIN ( + SELECT tt.Id_Ticket, COUNT(m.Id_Movimiento) as Lineas + FROM tmp.ticket_list tt + JOIN Movimientos m ON m.Id_Ticket = tt.Id_Ticket + JOIN Articles a ON a.Id_Article = m.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + JOIN reinos r ON r.id = tp.reino_id + WHERE reino = 'Artificial' + GROUP BY tt.Id_Ticket + HAVING Lineas >= 1 + ) sub ON sub.Id_Ticket = pb.Id_Ticket + SET pb.lineasArtificial = sub.Lineas; + + + -- Problemas por ticket + + UPDATE tmp.production_buffer pb + JOIN ( + SELECT Id_Ticket, COUNT(Id_Ticket) as problems, GROUP_CONCAT(problem) problem + FROM tmp.buffer_problems + GROUP BY Id_Ticket + ) p on p.Id_Ticket = pb.Id_Ticket + SET pb.problems = p.problems, + pb.problem = p.problem; + + -- Hora limite de preparación + + CALL production_buffer_set_priority; + + -- Entradas + + INSERT INTO tmp.production_buffer( + Fecha + , Id_Ticket + , Agencia + , Id_Cliente + , Consignatario + , state + , CodigoTrabajador + , m3 + , `lines` + ) + SELECT DISTINCT c.shipment AS Fecha + , c.Id_Entrada AS Id_Ticket + , warehouse.name + , c.Id_Proveedor + , c.ref AS Consignatario + , IF(BIT_OR(controlado.Id_Compra),6,IF(BIT_OR(preparado.Id_Compra),5,3)) AS state + , c.Id_Trabajador AS CodigoTrabajador + , round(sum(cm3) / 1000000,2) AS m3 + , count(c.Id_Compra) as `lines` + FROM v_compres c + INNER JOIN warehouse ON c.warehouse_id = warehouse.id + LEFT JOIN Compres_ok preparado ON c.Id_Compra = preparado.Id_Compra AND preparado.valor = 1 + LEFT JOIN Compres_ok controlado ON c.Id_Compra = controlado.Id_Compra AND controlado.valor = 2 + WHERE (warehouse_id_out = CASE vWarehouseId WHEN 0 THEN 1 ELSE vWarehouseId END + OR + warehouse_id_out = CASE vWarehouseId WHEN 0 THEN 44 ELSE vWarehouseId END) + AND IFNULL(c.Confirmada,FALSE) = FALSE + AND c.shipment >= CURDATE() + GROUP BY Id_Entrada; + + -- Refresca la caché para el cierre dinámico de agencias + + CALL cache.departure_timing; + + -- Tickets de recogida + + REPLACE tmp.production_buffer( + Fecha + , Id_Ticket + , Agencia + , Id_Cliente + , Consignatario + , state + , CodigoTrabajador + , alert_level + , warehouse_id + ) + SELECT + DATE(t.Fecha) AS Fecha + , t.Id_Ticket + , a.Agencia + , t.Id_Cliente + , CS.Consignatario + , s.id as state + , w.Codigotrabajador + , ifnull(tls.alertLevel,0) alert_level + , t.warehouse_id + FROM vn2008.Tickets t + JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket + JOIN vn2008.Consignatarios CS on CS.Id_Consigna = t.Id_Consigna + JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia + LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = a.Id_Agencia + LEFT JOIN vn.ticketState tls on tls.ticket = t.Id_Ticket + LEFT JOIN vn.state s ON s.id = tls.state + LEFT JOIN vn2008.Trabajadores w on w.Id_Trabajador = tls.worker + WHERE t.Fecha between TIMESTAMPADD(WEEK,-1,CURDATE()) AND dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -34169,7 +35228,7 @@ BEGIN SELECT empresa_id, proveedor_id, -1 * sum(cantidad) as Gestion FROM recibida_vencimiento rv INNER JOIN recibida r ON r.id = rv.recibida_id - WHERE IFNULL(r.dateBooking,r.fecha) BETWEEN datSTART AND datFEC + WHERE IFNULL(r.bookEntried,r.fecha) BETWEEN datSTART AND datFEC AND r.contabilizada GROUP BY r.id @@ -34429,6 +35488,257 @@ BEGIN -- Creamos una tabla con los Comerciales de los que se mostraran los tickets CALL subordinate(worker,TRUE); + -- Se genera una tabla con los tickets representados + DROP TEMPORARY TABLE IF EXISTS ticketRange; + CREATE TEMPORARY TABLE ticketRange + SELECT T.Id_Ticket, T.Id_Cliente, C.Id_Trabajador + FROM Tickets T + LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket + INNER JOIN Clientes C on C.Id_Cliente = T.Id_Cliente + INNER JOIN subordinate s1 ON C.Id_Trabajador = s1.Id_Trabajador + WHERE Fecha >= yesterday + AND Fecha <= maxDate AND T.Factura Is NULL + AND IFNULL(tls.alertLevel,0) < 3 + + UNION DISTINCT + + SELECT Id_Ticket, s.Id_Cliente, s.Id_Trabajador + FROM sharingclient s + INNER JOIN Tickets T USING(Id_Cliente) + LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket + INNER JOIN subordinate s2 ON s.Id_Trabajador = s2.Id_Trabajador + WHERE maxDate >= datSTART + AND datEND >= yesterday + AND date(Fecha) >= IF(yesterday > datSTART, yesterday, datSTART) + AND date(Fecha) <= IF(datEND > maxDate, maxDate, datEND) + AND IFNULL(tls.alertLevel,0) < 3 + + UNION DISTINCT + + SELECT Id_Ticket, C.Id_Cliente, s.Id_Suplente + FROM Clientes C + INNER JOIN Tickets T USING(Id_Cliente) + LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket + INNER JOIN sharingcart s ON s.Id_Trabajador = C.Id_Trabajador + INNER JOIN subordinate su on su.Id_Trabajador=Id_Suplente + WHERE maxDate >= datSTART + AND datEND >= yesterday + AND date(Fecha) >= IF(yesterday > datSTART, yesterday, datSTART) + AND date(Fecha) <= IF(datEND > maxDate, maxDate, datEND) + AND IFNULL(tls.alertLevel,0) < 3 + + UNION DISTINCT + + SELECT Id_Ticket, C.Id_Cliente, C.Id_Trabajador + FROM Clientes C + INNER JOIN Tickets T USING(Id_Cliente) + LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket + INNER JOIN workerTeamCollegues w ON w.collegueId = C.Id_Trabajador + /* + (SELECT Id_Trabajador + FROM Trabajadores t + JOIN account.user u ON u.id = t.user_id + JOIN workerTeam w on w.user = u.id + JOIN (SELECT team FROM workerTeam wt JOIN Trabajadores tr on tr.user_id = wt.user WHERE Id_Trabajador = worker) sub on sub.team = w.team + ) sub2 ON sub2.Id_Trabajador = C.Id_Trabajador + */ + WHERE Fecha >= yesterday + AND Fecha <= maxDate AND T.Factura Is NULL + AND IFNULL(tls.alertLevel,0) < 3 + AND w.workerId = worker; + + IF (SELECT COUNT(*) FROM ticketRange) THEN + + -- Generamos varias auxiliares (ya podian los de mysql haber solucionado esto) + + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; + CREATE TEMPORARY TABLE tmp.client_list + (INDEX (Id_Cliente)) + ENGINE = MEMORY + SELECT DISTINCT Id_Cliente FROM ticketRange; + + DROP TEMPORARY TABLE IF EXISTS cr5; + CREATE TEMPORARY TABLE cr5 + (INDEX (Id_Cliente)) + ENGINE = MEMORY + SELECT Id_Cliente FROM tmp.client_list; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT t.Id_Ticket ticketFk FROM Tickets t + STRAIGHT_JOIN tmp.client_list c ON t.Id_Cliente = c.Id_Cliente + WHERE Fecha BETWEEN dateStart AND maxDate + AND Factura Is NULL; + + CALL vn.ticketGetTotal(); + + -- Generamos otra tabla temporal con los Tickets_iva + + DROP TEMPORARY TABLE IF EXISTS tt3; + CREATE TEMPORARY TABLE tt3 + ENGINE = MEMORY + SELECT * FROM tmp.ticketTotal tt + JOIN ticketRange tr ON tr.Id_Ticket = tt.ticketFk; + + -- Generamos la lista de tickets y sus datos + + DROP TEMPORARY TABLE IF EXISTS Radartest; + + CREATE TEMPORARY TABLE Radartest + + SELECT IF(C.Id_Trabajador = worker, 1, 0) as Propio, + Credito, + CAST(Riesgo AS DECIMAL (10,2)) Riesgo, + -- Greuge, + T.Id_Ticket, + T.warehouse_id as wh, + T.Fecha, + T.Alias, + -- T.Vista, + REPEAT(' ',50) as problem, + T.Agencia Tipo, + -- C.Id_Trabajador, + T.workerId AS Id_Trabajador, + T.Solucion, + T.Localizacion, + IFNULL(state,'LIBRE') as Estado, + alertLevel, + alertCode, + Date(T.Fecha) as Fecha_Simple, + CAST(T.Importe AS DECIMAL (10,2)) Importe, + C.Descuento, + C.calidad, + C.Id_Cliente, + p.`name` provincia + FROM Clientes C + INNER JOIN + + ( + + SELECT T.* , A.Vista, A.Agencia, s.`name` as state, alertLevel, s.`code` AS alertCode, tt3.Id_Trabajador AS workerId, + + tt3.total as Importe, + + 0 AS inacabable + + -- (-1 < ifnull(order_id,-1)) as isbionic + + FROM Tickets T + LEFT JOIN vn.ticketState ts on ts.ticket = T.Id_Ticket + LEFT JOIN vn2008.state s on s.id = ts.state + + INNER JOIN tt3 ON tt3.ticketFk = T.Id_Ticket + + -- LEFT JOIN (SELECT DISTINCT 1 as order_id, Id_Ticket FROM order_Tickets) o on o.Id_Ticket = T.Id_Ticket + + INNER JOIN Agencias A ON A.Id_Agencia = T.Id_Agencia + + -- WHERE T.Etiquetasemitidas = FALSE + GROUP BY T.Id_Ticket + + ) AS T ON T.Id_Cliente = C.Id_Cliente + + LEFT JOIN Consignatarios co ON co.Id_Consigna = T.Id_Consigna + LEFT JOIN province p ON p.province_id = co.province_id + + LEFT JOIN + + ( + + SELECT TOTAL.Id_Cliente, ROUND(SUM(amount),2) as Riesgo FROM + + (SELECT cl.Id_Cliente, amount FROM bi.customer_risk cr + INNER JOIN tmp.client_list cl ON cr.customer_id = cl.Id_Cliente + + UNION ALL + + SELECT t.Id_Cliente, tt.total FROM tmp.ticketTotal tt + INNER JOIN Tickets t ON t.Id_Ticket = tt.ticketFk + INNER JOIN cr5 C ON C.Id_Cliente = t.Id_Cliente + WHERE t.Fecha BETWEEN dateStart AND maxDate + AND t.Factura is null + + ) as TOTAL GROUP BY TOTAL.Id_Cliente + + ) AS Peligros ON Peligros.Id_Cliente = C.Id_Cliente + ; + -- Actualizamos el Riesgo con los tickets futuros + set @cliente:= 0; + SET @riesgo := 0; + + UPDATE Radartest SET Riesgo = + IF(@cliente <> @cliente:= Id_Cliente , - Importe + @riesgo:= - Riesgo + Importe , - Importe + @riesgo:= @riesgo + Importe) + order by Id_Cliente, Fecha_Simple DESC; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + + CREATE TEMPORARY TABLE tmp.ticket_list + SELECT Id_Ticket, Id_Cliente FROM Radartest; + + CALL prepare_client_list(); + CALL production_buffer_problems; + + UPDATE Radartest r + JOIN ( + SELECT Id_Ticket, GROUP_CONCAT(problem) problem + FROM tmp.buffer_problems + GROUP BY Id_Ticket + ) p on p.Id_Ticket = r.Id_Ticket + SET r.problem = p.problem; + + + + SELECT R.*, Riesgo + Credito as Risk , CodigoTrabajador + FROM Radartest R + INNER JOIN vn2008.Trabajadores trab on R.Id_Trabajador=trab.Id_Trabajador; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS ticketRange; + DROP TABLE IF EXISTS subordinate; + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; + DROP TEMPORARY TABLE IF EXISTS cr5; + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + + +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 DROP PROCEDURE IF EXISTS `radartest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `radartest`(IN today DATETIME, IN worker INTEGER, IN scopeDays SMALLINT) +BEGIN + + DECLARE todayMidnight DATE DEFAULT TIMESTAMP(today,'23:59:59'); + DECLARE yesterday DATETIME; + DECLARE maxDate DATETIME; + DECLARE datBUF DATETIME; + DECLARE warehouse INTEGER; + DECLARE done BIT DEFAULT 0; + DECLARE visible_calc INTEGER; + DECLARE available_calc INTEGER; + DECLARE dateStart DATE; + + SET dateStart = TIMESTAMPADD(MONTH, -2, CURDATE()); + SELECT TIMESTAMPADD(DAY, -1, today) INTO yesterday; + -- lo quitamos despues de campañaA + SELECT TIMESTAMP(TIMESTAMPADD(DAY, scopeDays, yesterday),'23:59:59') INTO maxDate; + -- SELECT TIMESTAMP(TIMESTAMPADD(DAY, 14, yesterday),'23:59:59') INTO maxDate; + -- Creamos una tabla con los Comerciales de los que se mostraran los tickets + CALL subordinate(worker,TRUE); + -- Se genera una tabla con los tickets representados DROP TEMPORARY TABLE IF EXISTS ticketRange; @@ -34530,323 +35840,39 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS Radartest; CREATE TEMPORARY TABLE Radartest - - SELECT IF(C.Id_Trabajador = worker, 1, 0) as Propio, - Credito, - Riesgo, - -- Greuge, - T.Id_Ticket, - T.warehouse_id as wh, - T.Fecha, - T.Alias, - -- T.Vista, - REPEAT(' ',50) as problem, - T.Agencia Tipo, - -- C.Id_Trabajador, - T.workerId AS Id_Trabajador, - T.Solucion, - T.Localizacion, - IFNULL(state,'LIBRE') as Estado, - alertLevel, - alertCode, - Date(T.Fecha) as Fecha_Simple, - T.Importe, - C.Descuento, - C.calidad, - C.Id_Cliente, - p.`name` provincia - FROM Clientes C - INNER JOIN - - ( - - SELECT T.* , A.Vista, A.Agencia, s.`name` as state, alertLevel, s.`code` AS alertCode, tt3.Id_Trabajador AS workerId, - - tt3.total as Importe, - - 0 AS inacabable - - -- (-1 < ifnull(order_id,-1)) as isbionic - - FROM Tickets T - LEFT JOIN vn.ticketState ts on ts.ticket = T.Id_Ticket - LEFT JOIN vn2008.state s on s.id = ts.state - - INNER JOIN tt3 ON tt3.ticket_id = T.Id_Ticket - - -- LEFT JOIN (SELECT DISTINCT 1 as order_id, Id_Ticket FROM order_Tickets) o on o.Id_Ticket = T.Id_Ticket - - INNER JOIN Agencias A ON A.Id_Agencia = T.Id_Agencia - - -- WHERE T.Etiquetasemitidas = FALSE - GROUP BY T.Id_Ticket - - ) AS T ON T.Id_Cliente = C.Id_Cliente - - LEFT JOIN Consignatarios co ON co.Id_Consigna = T.Id_Consigna - LEFT JOIN province p ON p.province_id = co.province_id - - LEFT JOIN - - ( - - SELECT TOTAL.Id_Cliente, ROUND(SUM(amount),2) as Riesgo FROM - - (SELECT cl.Id_Cliente, amount FROM bi.customer_risk cr - INNER JOIN tmp.client_list cl ON cr.customer_id = cl.Id_Cliente - - UNION ALL - - SELECT t.Id_Cliente, tt.total FROM ticket_total tt - INNER JOIN Tickets t ON t.Id_Ticket = tt.ticket_id - INNER JOIN cr5 C ON C.Id_Cliente = t.Id_Cliente - WHERE t.Fecha BETWEEN dateStart AND maxDate - AND t.Factura is null - - ) as TOTAL GROUP BY TOTAL.Id_Cliente - - - ) AS Peligros ON Peligros.Id_Cliente = C.Id_Cliente - ; - -- Actualizamos el Riesgo con los tickets futuros - set @cliente:= 0; - SET @riesgo := 0; - - UPDATE Radartest SET Riesgo = - IF(@cliente <> @cliente:= Id_Cliente , - Importe + @riesgo:= - Riesgo + Importe , - Importe + @riesgo:= @riesgo + Importe) - order by Id_Cliente, Fecha_Simple DESC; - - - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - - CREATE TEMPORARY TABLE tmp.ticket_list - SELECT Id_Ticket, Id_Cliente FROM Radartest; - - CALL prepare_client_list(); - CALL production_buffer_problems; - - UPDATE Radartest r - JOIN ( - SELECT Id_Ticket, GROUP_CONCAT(problem) problem - FROM tmp.buffer_problems - GROUP BY Id_Ticket - ) p on p.Id_Ticket = r.Id_Ticket - SET r.problem = p.problem; - - - - SELECT R.*, Riesgo + Credito as Risk , CodigoTrabajador - FROM Radartest R - INNER JOIN vn2008.Trabajadores trab on R.Id_Trabajador=trab.Id_Trabajador; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS ticketRange; - DROP TABLE IF EXISTS subordinate; - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; - DROP TEMPORARY TABLE IF EXISTS cr5; - -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 DROP PROCEDURE IF EXISTS `radartest` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `radartest`(IN today DATETIME, IN worker INTEGER, IN scopeDays SMALLINT) -BEGIN - - DECLARE todayMidnight DATE DEFAULT TIMESTAMP(today,'23:59:59'); - DECLARE yesterday DATETIME; - DECLARE maxDate DATETIME; - DECLARE datBUF DATETIME; - DECLARE warehouse INTEGER; - DECLARE done BIT DEFAULT 0; - DECLARE visible_calc INTEGER; - DECLARE available_calc INTEGER; - DECLARE dateStart DATE; - - SET dateStart = TIMESTAMPADD(MONTH, -2, CURDATE()); - SELECT TIMESTAMPADD(DAY, -1, today) INTO yesterday; - -- lo quitamos despues de campañaA - SELECT TIMESTAMP(TIMESTAMPADD(DAY, scopeDays, yesterday),'23:59:59') INTO maxDate; - -- SELECT TIMESTAMP(TIMESTAMPADD(DAY, 14, yesterday),'23:59:59') INTO maxDate; - -- Creamos una tabla con los Comerciales de los que se mostraran los tickets - CALL subordinate(worker,TRUE); - - - -- Se genera una tabla con los tickets representados - DROP TEMPORARY TABLE IF EXISTS ticketRange; - - CREATE TEMPORARY TABLE ticketRange - SELECT T.Id_Ticket, T.Id_Cliente, C.Id_Trabajador - FROM Tickets T - LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket - INNER JOIN Clientes C on C.Id_Cliente = T.Id_Cliente - INNER JOIN subordinate s1 ON C.Id_Trabajador = s1.Id_Trabajador - WHERE Fecha >= yesterday - AND Fecha <= maxDate AND T.Factura Is NULL - AND IFNULL(tls.alertLevel,0) < 3 - - UNION DISTINCT - - SELECT Id_Ticket, s.Id_Cliente, s.Id_Trabajador - FROM sharingclient s - INNER JOIN Tickets T USING(Id_Cliente) - LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket - INNER JOIN subordinate s2 ON s.Id_Trabajador = s2.Id_Trabajador - WHERE maxDate >= datSTART - AND datEND >= yesterday - AND date(Fecha) >= IF(yesterday > datSTART, yesterday, datSTART) - AND date(Fecha) <= IF(datEND > maxDate, maxDate, datEND) - AND IFNULL(tls.alertLevel,0) < 3 - - UNION DISTINCT - - SELECT Id_Ticket, C.Id_Cliente, s.Id_Suplente - FROM Clientes C - INNER JOIN Tickets T USING(Id_Cliente) - LEFT JOIN vn.ticketState tls on tls.ticket = T.Id_Ticket - INNER JOIN sharingcart s ON s.Id_Trabajador = C.Id_Trabajador - INNER JOIN subordinate su on su.Id_Trabajador=Id_Suplente - WHERE maxDate >= datSTART - AND datEND >= yesterday - AND date(Fecha) >= IF(yesterday > datSTART, yesterday, datSTART) - AND date(Fecha) <= IF(datEND > maxDate, maxDate, datEND) - AND IFNULL(tls.alertLevel,0) < 3; - - IF (SELECT COUNT(*) FROM ticketRange) THEN - - -- Generamos varias auxiliares (ya podian los de mysql haber solucionado esto) - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; - CREATE TEMPORARY TABLE tmp.client_list - (INDEX (Id_Cliente)) - ENGINE = MEMORY - SELECT DISTINCT Id_Cliente FROM ticketRange; - - DROP TEMPORARY TABLE IF EXISTS cr5; - CREATE TEMPORARY TABLE cr5 - (INDEX (Id_Cliente)) - ENGINE = MEMORY - SELECT Id_Cliente FROM tmp.client_list; - - -- usar ticket_total crear ticket_tmp(ticket_id) - DROP TEMPORARY TABLE IF EXISTS ticket_tmp; - CREATE TEMPORARY TABLE `ticket_tmp` + (INDEX (Id_Ticket)) ENGINE = MEMORY - SELECT t.Id_Ticket ticket_id FROM Tickets t - STRAIGHT_JOIN tmp.client_list c ON t.Id_Cliente = c.Id_Cliente - WHERE Fecha BETWEEN dateStart AND maxDate - AND Factura Is NULL; - - CALL ticket_total(); - - - -- Generamos otra tabla temporal con los Tickets_iva - - DROP TEMPORARY TABLE IF EXISTS tt3; - CREATE TEMPORARY TABLE tt3 - ENGINE = MEMORY - SELECT * FROM ticket_total tt - JOIN ticketRange tr ON tr.Id_Ticket = tt.ticket_id; - - - -- Generamos la lista de tickets y sus datos - - DROP TEMPORARY TABLE IF EXISTS Radartest; - - CREATE TEMPORARY TABLE Radartest - - SELECT IF(C.Id_Trabajador = worker, 1, 0) as Propio, + SELECT IF(c.Id_Trabajador = worker, 1, 0) as Propio, Credito, - Riesgo, + 0 Riesgo, -- Greuge, - T.Id_Ticket, - T.warehouse_id as wh, - T.Fecha, - T.Alias, + t.Id_Ticket, + t.warehouse_id as wh, + t.Fecha, + t.Alias, -- T.Vista, REPEAT(' ',50) as problem, - T.Agencia Tipo, - -- C.Id_Trabajador, - T.workerId AS Id_Trabajador, - T.Solucion, - T.Localizacion, - IFNULL(state,'LIBRE') as Estado, - alertLevel, - Date(T.Fecha) as Fecha_Simple, - T.Importe, - C.Descuento, - C.calidad, - C.Id_Cliente, + a.Agencia Tipo, + tt3.Id_Trabajador, + t.Solucion, + t.Localizacion, + IFNULL(s.`name`,'LIBRE') as Estado, + ts.alertLevel, + Date(t.Fecha) as Fecha_Simple, + tt3.total as Importe, + c.Descuento, + c.calidad, + c.Id_Cliente, p.`name` provincia - FROM Clientes C - INNER JOIN - - ( - - SELECT T.* , A.Vista, A.Agencia, s.`name` as state, alertLevel, tt3.Id_Trabajador AS workerId, - - tt3.total as Importe, - - 0 AS inacabable - - -- (-1 < ifnull(order_id,-1)) as isbionic - - FROM Tickets T - LEFT JOIN vn.ticketState ts on ts.ticket = T.Id_Ticket - LEFT JOIN vn2008.state s on s.id = ts.state - - INNER JOIN tt3 ON tt3.ticket_id = T.Id_Ticket - - -- LEFT JOIN (SELECT DISTINCT 1 as order_id, Id_Ticket FROM order_Tickets) o on o.Id_Ticket = T.Id_Ticket - - INNER JOIN Agencias A ON A.Id_Agencia = T.Id_Agencia - - -- WHERE T.Etiquetasemitidas = FALSE - GROUP BY T.Id_Ticket - - ) AS T ON T.Id_Cliente = C.Id_Cliente - - LEFT JOIN Consignatarios co ON co.Id_Consigna = T.Id_Consigna - LEFT JOIN province p ON p.province_id = co.province_id - - LEFT JOIN - - ( - - SELECT TOTAL.Id_Cliente, ROUND(SUM(amount),2) as Riesgo FROM - - (SELECT cl.Id_Cliente, amount FROM bi.customer_risk cr - INNER JOIN tmp.client_list cl ON cr.customer_id = cl.Id_Cliente - - UNION ALL - - SELECT t.Id_Cliente, tt.total FROM ticket_total tt - INNER JOIN Tickets t ON t.Id_Ticket = tt.ticket_id - INNER JOIN cr5 C ON C.Id_Cliente = t.Id_Cliente - WHERE t.Fecha BETWEEN dateStart AND maxDate - AND t.Factura is null - - ) as TOTAL GROUP BY TOTAL.Id_Cliente - - - ) AS Peligros ON Peligros.Id_Cliente = C.Id_Cliente - - - ; - + FROM tt3 + JOIN Tickets t ON t.Id_Ticket = tt3.ticket_id + JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente + LEFT JOIN vn.ticketState ts on ts.ticket = tt3.ticket_id + LEFT JOIN vn2008.state s on s.id = ts.state + JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia + LEFT JOIN Consignatarios co ON co.Id_Consigna = t.Id_Consigna + LEFT JOIN province p ON p.province_id = co.province_id; + -- Actualizamos el Riesgo con los tickets futuros set @cliente:= 0; SET @riesgo := 0; @@ -34864,7 +35890,7 @@ BEGIN CALL prepare_client_list(); CALL production_buffer_problems; - + UPDATE Radartest r JOIN ( SELECT Id_Ticket, GROUP_CONCAT(problem) problem @@ -34991,6 +36017,100 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS article_minacum; +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 DROP PROCEDURE IF EXISTS `raidUpdate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `raidUpdate`() +BEGIN + UPDATE travel + SET shipment = CURDATE(), + landing = TIMESTAMPADD(DAY, 1, CURDATE()) + WHERE id = 12505; + + UPDATE Entradas e + JOIN Entradas_Auto ea USING (Id_Entrada) + JOIN travel t ON t.id = e.travel_id + JOIN ( + SELECT * + FROM ( + SELECT id, landing, warehouse_id, warehouse_id_out + FROM travel + JOIN ( + SELECT warehouse_id, warehouse_id_out + FROM Entradas_Auto ea + JOIN Entradas e USING(Id_Entrada) + JOIN travel t ON t.id = e.travel_id + GROUP BY warehouse_id, warehouse_id_out + ) t USING (warehouse_id, warehouse_id_out) + WHERE shipment > CURDATE() AND delivered = FALSE + ORDER BY landing + ) t + GROUP BY warehouse_id, warehouse_id_out + ) t USING (warehouse_id, warehouse_id_out) + SET e.travel_id = t.id; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `rateView` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `rateView`() +BEGIN + + SELECT + t.year as año, + t.month as mes, + pagos.dolares, + pagos.cambioPractico, + CAST(sum(divisa) / sum(bi) as DECIMAL(5,4)) as cambioTeorico, + pagos.cambioOficial + FROM recibida r + JOIN time t ON t.date = r.fecha + JOIN recibida_iva ri ON r.id = ri.recibida_id + JOIN + ( + SELECT + t.year as Año, + t.month as Mes, + cast(sum(divisa) as DECIMAL(10,2)) as dolares, + cast(sum(divisa) / sum(importe) as DECIMAL(5,4)) as cambioPractico, + cast(rr.rate * 0.998 as DECIMAL(5,4)) as cambioOficial + FROM pago p + JOIN time t ON t.date = p.fecha + JOIN reference_rate rr ON rr.date = p.fecha AND moneda_id = 2 + WHERE divisa + AND fecha >= '2015-01-11' + GROUP BY t.year, t.month + ) pagos ON t.year = pagos.Año AND t.month = pagos.Mes + WHERE moneda_id = 2 + AND fecha >= '2015-01-01' + AND divisa + AND bi + GROUP BY t.year, t.month; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35105,6 +36225,77 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `recibidaIvaDivisaUpdate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `recibidaIvaDivisaUpdate`(IN vRecibidaId INT) +BEGIN + +/* Actualiza el valor de la divisa en función del cambio oficial para el dia de expedicion +*/ + UPDATE recibida_iva + SET bi = NULL + WHERE recibida_id = vRecibidaId + AND divisa IS NOT NULL; + + UPDATE recibida_iva ri + JOIN recibida r ON r.id = ri.recibida_id + JOIN reference_rate rr ON rr.date = r.fecha AND r.moneda_id = rr.moneda_id + SET ri.bi = ri.divisa / rr.rate + WHERE r.id = vRecibidaId; + +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 DROP PROCEDURE IF EXISTS `recibidaIvaInsert` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `recibidaIvaInsert`(IN vId INT) +BEGIN + + INSERT INTO recibida_iva(recibida_id, iva_id, bi,gastos_id,divisa) + SELECT r.id, + CASE + WHEN p.cuenta LIKE '___4______' THEN 71 + WHEN p.cuenta LIKE '___1______' THEN 36 + WHEN p.cuenta LIKE '___3______' THEN 63 + END, + SUM(Costefijo * Cantidad) / IFNULL(rr.rate,1), + 6003000000, + IF(r.moneda_id = 1,NULL,SUM(Costefijo * Cantidad )) + FROM recibida r + JOIN recibida_entrada re ON r.id = re.recibida_id + JOIN Entradas e ON e.Id_Entrada = re.Id_Entrada + JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor + JOIN Compres c ON c.Id_Entrada = e.Id_Entrada + JOIN reference_rate rr ON rr.moneda_id = r.moneda_id AND rr.date = r.fecha + LEFT JOIN recibida_iva ri ON re.recibida_id=ri.recibida_id + WHERE re.awb_recibida =vId AND ri.bi IS NULL + GROUP BY e.Id_Entrada, re.awb_recibida; + +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 DROP PROCEDURE IF EXISTS `recibida_select` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -35601,7 +36792,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `recobro_credito`() BEGIN @@ -35637,7 +36828,12 @@ JOIN clientes_credit using(Id_Cliente) SET Clientes.Credito = newCredit; - +/* +Lo hace el trigger JGF 2017/10/18 +INSERT INTO credit(Id_Cliente, amount, Id_Trabajador) +SELECT Id_Cliente, newCredit, 20 +FROM clientes_credit; +*/ END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35879,7 +37075,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `risk` */; +/*!50003 DROP PROCEDURE IF EXISTS `riskkk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -35889,16 +37085,16 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `risk`(v_date DATE, v_customer INT) +CREATE DEFINER=`root`@`%` PROCEDURE `riskkk`(v_date DATE, v_customer INT) BEGIN /** * Calcula el riesgo para uno o todos los clientes activos. * + * @deprecated usar vn.clientGetDebt * @param v_date Fecha maxima de los registros * @param v_customer Cliente a mostrar su riesgo, %NULL para todos - * * @return table tmp.risk - **/ + */ DECLARE v_date_start DATETIME DEFAULT TIMESTAMPADD(MONTH, -33, CURDATE()); DECLARE v_date_end DATETIME; @@ -35914,8 +37110,6 @@ BEGIN AND t.Fecha BETWEEN v_date_start AND v_date_end; CALL ticket_total(); - - DROP TEMPORARY TABLE IF EXISTS tmp.risk; CREATE TEMPORARY TABLE tmp.risk @@ -35939,12 +37133,12 @@ BEGIN JOIN Tickets t ON tt.ticket_id = t.Id_Ticket GROUP BY t.Id_Cliente UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - WHERE (v_customer IS NULL OR t.customer_id = v_customer) - AND t.receipt_id IS NULL + SELECT t.clientFk customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + WHERE (v_customer IS NULL OR t.clientFk = v_customer) + AND t.receiptFk IS NULL AND t.status = 'ok' - GROUP BY t.customer_id + GROUP BY t.clientFk ) t ON c.Id_Cliente = t.customer_id WHERE c.activo != FALSE GROUP BY c.Id_Cliente; @@ -35973,47 +37167,43 @@ BEGIN /** * Calcula el riesgo para los clientes activos de la tabla temporal tmp.client_list * + * @deprecated usar vn.clientGetDebt * @param maxRiskDate Fecha maxima de los registros * @return table tmp.risk - **/ - - -- DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(DAY, -40, CURDATE()); - DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 5, CURDATE()); + */ + DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 30, CURDATE()); DECLARE endingDate DATETIME; - DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; - - SET maxRiskDate = IFNULL(maxRiskDate, CURDATE()); - SET endingDate = TIMESTAMP(maxRiskDate, '23:59:59'); - - - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list_2; - CREATE TEMPORARY TABLE tmp.client_list_2 - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * - FROM tmp.client_list; - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list_3; - CREATE TEMPORARY TABLE tmp.client_list_3 - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * - FROM tmp.client_list; + DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; + + SET maxRiskDate = IFNULL(maxRiskDate, CURDATE()); + SET endingDate = TIMESTAMP(maxRiskDate, '23:59:59'); + + DROP TEMPORARY TABLE IF EXISTS tmp.client_list_2; + CREATE TEMPORARY TABLE tmp.client_list_2 + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT * + FROM tmp.client_list; + + DROP TEMPORARY TABLE IF EXISTS tmp.client_list_3; + CREATE TEMPORARY TABLE tmp.client_list_3 + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT * + FROM tmp.client_list; - DROP TEMPORARY TABLE IF EXISTS tmp.tickets_sin_facturar; CREATE TEMPORARY TABLE tmp.tickets_sin_facturar - (PRIMARY KEY (Id_Cliente)) + (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY - SELECT t.Id_Cliente, floor(IF(VIES, 1, 1.1) * sum(Cantidad * Preu * (100 - Descuento) / 100)) as total - FROM Movimientos m - JOIN Tickets t on m.Id_Ticket = t.Id_Ticket - JOIN tmp.client_list c on c.Id_Cliente = t.Id_Cliente - JOIN vn.client cl ON cl.id = t.Id_Cliente - WHERE Factura IS NULL - AND Fecha BETWEEN startingDate AND endingDate - GROUP BY t.Id_Cliente; + SELECT t.Id_Cliente, floor(IF(cl.isVies, 1, 1.1) * sum(Cantidad * Preu * (100 - Descuento) / 100)) as total + FROM Movimientos m + JOIN Tickets t on m.Id_Ticket = t.Id_Ticket + JOIN tmp.client_list c on c.Id_Cliente = t.Id_Cliente + JOIN vn.client cl ON cl.id = t.Id_Cliente + WHERE Factura IS NULL + AND Fecha BETWEEN startingDate AND endingDate + GROUP BY t.Id_Cliente; DROP TEMPORARY TABLE IF EXISTS tmp.risk; CREATE TEMPORARY TABLE tmp.risk @@ -36021,142 +37211,38 @@ BEGIN ENGINE = MEMORY SELECT Id_Cliente, SUM(amount) risk, sum(saldo) saldo FROM Clientes c - JOIN ( - SELECT customer_id, SUM(amount) amount,SUM(amount) saldo - FROM bi.customer_risk - JOIN tmp.client_list on Id_Cliente = customer_id - GROUP BY customer_id - UNION ALL - SELECT Id_Cliente, SUM(Entregado),SUM(Entregado) - FROM Recibos - JOIN tmp.client_list_2 using(Id_Cliente) - WHERE Fechacobro > endingDate - GROUP BY Id_Cliente - UNION ALL - SELECT Id_Cliente, total,0 - FROM tmp.tickets_sin_facturar - UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)), CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - JOIN tmp.client_list_3 on Id_Cliente = customer_id - WHERE t.receipt_id IS NULL + JOIN ( + SELECT customer_id, SUM(amount) amount,SUM(amount) saldo + FROM bi.customer_risk + JOIN tmp.client_list on Id_Cliente = customer_id + GROUP BY customer_id + UNION ALL + SELECT Id_Cliente, SUM(Entregado),SUM(Entregado) + FROM Recibos + JOIN tmp.client_list_2 using(Id_Cliente) + WHERE Fechacobro > endingDate + GROUP BY Id_Cliente + UNION ALL + SELECT Id_Cliente, total,0 + FROM tmp.tickets_sin_facturar + UNION ALL + SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)), CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + JOIN tmp.client_list_3 on Id_Cliente = t.clientFk + WHERE t.receiptFk IS NULL AND t.status = 'ok' - GROUP BY t.customer_id - ) t ON c.Id_Cliente = t.customer_id + GROUP BY t.clientFk + ) t ON c.Id_Cliente = t.customer_id WHERE c.activo != FALSE GROUP BY c.Id_Cliente; - + DELETE r.* - FROM tmp.risk r - JOIN vn2008.Clientes c on c.Id_Cliente = r.Id_Cliente - JOIN vn2008.pay_met pm on pm.id = c.pay_met_id - WHERE IFNULL(r.saldo,0) < 10 - AND r.risk <= MAX_RISK_ALLOWED - AND pm.`name` = 'TARJETA'; - -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 DROP PROCEDURE IF EXISTS `risk_vs_client_listbeta` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `risk_vs_client_listbeta`(maxRiskDate DATE) -BEGIN -/** - * Calcula el riesgo para los clientes activos de la tabla temporal tmp.client_list - * - * @param maxRiskDate Fecha maxima de los registros - * @return table tmp.risk - **/ - - -- DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(DAY, -40, CURDATE()); - DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 5, CURDATE()); - DECLARE endingDate DATETIME; - DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; - - SET maxRiskDate = IFNULL(maxRiskDate, CURDATE()); - SET endingDate = TIMESTAMP(maxRiskDate, '23:59:59'); - - - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list_2; - CREATE TEMPORARY TABLE tmp.client_list_2 - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * - FROM tmp.client_list; - select 1; - DROP TEMPORARY TABLE IF EXISTS tmp.client_list_3; - CREATE TEMPORARY TABLE tmp.client_list_3 - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * - FROM tmp.client_list; - - select 2; - DROP TEMPORARY TABLE IF EXISTS tmp.tickets_sin_facturar; - CREATE TEMPORARY TABLE tmp.tickets_sin_facturar - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT t.Id_Cliente, Cantidad as total - FROM Movimientos m - JOIN Tickets t on m.Id_Ticket = t.Id_Ticket - JOIN tmp.client_list c on c.Id_Cliente = t.Id_Cliente - WHERE Factura IS NULL - AND Fecha BETWEEN startingDate AND endingDate - GROUP BY t.Id_Cliente; -select 3; - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - CREATE TEMPORARY TABLE tmp.risk - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT Id_Cliente, SUM(amount) risk, sum(saldo) saldo - FROM Clientes c - JOIN ( - SELECT customer_id, SUM(amount) amount,SUM(amount) saldo - FROM bi.customer_risk - JOIN tmp.client_list on Id_Cliente = customer_id - GROUP BY customer_id - UNION ALL - SELECT Id_Cliente, SUM(Entregado),SUM(Entregado) - FROM Recibos - JOIN tmp.client_list_2 using(Id_Cliente) - WHERE Fechacobro > endingDate - GROUP BY Id_Cliente - UNION ALL - SELECT Id_Cliente, total,0 - FROM tmp.tickets_sin_facturar - UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)), CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - JOIN tmp.client_list_3 on Id_Cliente = customer_id - WHERE t.receipt_id IS NULL - AND t.status = 'ok' - GROUP BY t.customer_id - ) t ON c.Id_Cliente = t.customer_id - WHERE c.activo != FALSE - GROUP BY c.Id_Cliente; -select 4; - DELETE r.* - FROM tmp.risk r - JOIN vn2008.Clientes c on c.Id_Cliente = r.Id_Cliente - JOIN vn2008.pay_met pm on pm.id = c.pay_met_id - WHERE IFNULL(r.saldo,0) < 10 - AND r.risk <= MAX_RISK_ALLOWED - AND pm.`name` = 'TARJETA'; -select 5; - - + FROM tmp.risk r + JOIN vn2008.Clientes c on c.Id_Cliente = r.Id_Cliente + JOIN vn2008.pay_met pm on pm.id = c.pay_met_id + WHERE IFNULL(r.saldo,0) < 10 + AND r.risk <= MAX_RISK_ALLOWED + AND pm.`name` = 'TARJETA'; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36217,6 +37303,104 @@ UNION ALL where t.shipment between TIMESTAMPADD(DAY,-1,datSTART) and TIMESTAMPADD(DAY,-1,datEND) group by a.Agencia, Almacen, Fecha; +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 DROP PROCEDURE IF EXISTS `Rutas_monitor_update` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `Rutas_monitor_update`(vDate DATE) +BEGIN + +DECLARE vDateEND DATETIME; + +SET vDateEND = util.dayend(vDate); +SET vDate = TIMESTAMPADD(DAY,-1,vDate); + +INSERT IGNORE INTO Rutas_monitor(Id_Ruta) + SELECT DISTINCT Id_Ruta + FROM Tickets + WHERE Fecha BETWEEN vDate AND vDateEND + AND Id_Ruta; + +UPDATE Rutas_monitor rm +JOIN Rutas r ON r.Id_Ruta = rm.Id_Ruta +JOIN Agencias a ON a.Id_Agencia = r.Id_Agencia +SET rm.`name` = a.Agencia, rm.fecha = r.Fecha, + rm.pedidosLibres = 0, + rm.pedidosProduccion = 0, + rm.pedidosEncajados = 0, + rm.Fecha = r.Fecha; +/* +UPDATE Rutas_monitor rm +JOIN ( + SELECT Id_Ruta, max(landing) as landing + FROM Tickets t + WHERE t.Fecha BETWEEN vDate AND vDateEND + GROUP BY Id_Ruta + ) t ON t.Id_Ruta = rm.Id_Ruta +SET rm.Fecha = t.landing; +*/ +UPDATE Rutas_monitor rm +JOIN +( SELECT Id_Ruta, count(*) AS pedidosLibres + FROM Tickets t + JOIN Tickets_state ts ON t.Id_Ticket = ts.Id_Ticket + JOIN vncontrol.inter i ON i.inter_id = ts.inter_id + JOIN state s ON i.state_id = s.id AND s.alert_level = 0 + WHERE t.Fecha BETWEEN vDate AND vDateEND + AND Id_Ruta + GROUP BY Id_Ruta +) t ON t.Id_Ruta = rm.Id_Ruta +SET rm.pedidosLibres = t.pedidosLibres; + +UPDATE Rutas_monitor rm +JOIN +( SELECT Id_Ruta, count(*) AS pedidosProduccion + FROM Tickets t + JOIN Tickets_state ts ON t.Id_Ticket = ts.Id_Ticket + JOIN vncontrol.inter i ON i.inter_id = ts.inter_id + JOIN state s ON i.state_id = s.id AND s.alert_level = 1 + WHERE t.Fecha BETWEEN vDate AND vDateEND + AND Id_Ruta + GROUP BY Id_Ruta +) t ON t.Id_Ruta = rm.Id_Ruta +SET rm.pedidosProduccion = t.pedidosProduccion; + +UPDATE Rutas_monitor rm +JOIN +( SELECT Id_Ruta, count(*) AS pedidosEncajados + FROM Tickets t + JOIN Tickets_state ts ON t.Id_Ticket = ts.Id_Ticket + JOIN vncontrol.inter i ON i.inter_id = ts.inter_id + JOIN state s ON i.state_id = s.id AND s.alert_level >= 2 + WHERE t.Fecha BETWEEN vDate AND vDateEND + AND Id_Ruta + GROUP BY Id_Ruta +) t ON t.Id_Ruta = rm.Id_Ruta +SET rm.pedidosEncajados = t.pedidosEncajados; + +UPDATE Rutas_monitor rm +JOIN +( SELECT Id_Ruta, count(*) AS bultos + FROM Tickets t + JOIN expeditions e ON e.ticket_id = t.Id_Ticket + WHERE t.Fecha BETWEEN vDate AND vDateEND + AND Id_Ruta + GROUP BY Id_Ruta +) t ON t.Id_Ruta = rm.Id_Ruta +SET rm.bultos = t.bultos; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36883,11 +38067,11 @@ 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 = latin1 */ ; -/*!50003 SET character_set_results = latin1 */ ; -/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `sql_query`(IN v_sql TEXT) BEGIN @@ -37093,6 +38277,94 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `supplierExcerpt` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `supplierExcerpt`(vSupplierFk INT, vCurrencyFk INT, vCompanyFk INT, vOrderBy VARCHAR(15)) +BEGIN + SET @saldo_eur:= 0; + SET @saldo_div:= 0; + + 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 + 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) + GROUP BY rv.id + + UNION ALL SELECT + p.id_banco, + p.empresa_id, + NULL, + p.id, + 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, + IFNULL(conciliado, 0), + Moneda, + pago_sdc_id + 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) + ) AS SUB + ORDER BY fecha, id) 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 DROP PROCEDURE IF EXISTS `suppliersDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -37585,89 +38857,43 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_iva`(billing_date DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_iva`(vBillingDate DATE) + READS SQL DATA BEGIN /** * Calcula la base imponible, el IVA y el recargo de equivalencia para * un conjunto de tickets. * - * @param table ticket_tmp(ticket_id) Tabla con el listado de tickets - * @param billing_date Fecha de facturación + * @deprecated Use procedure vn.ticketGetTax() instead * - * @return table ticket_iva - **/ + * @table ticket_tmp(ticket_id) Tabla con el listado de tickets + * @param billing_date Fecha de facturación + * @treturn ticket_iva + */ + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticket_id ticketFk FROM ticket_tmp; - DECLARE clean CONDITION FOR SQLSTATE 'HY000'; - DECLARE CONTINUE HANDLER FOR clean - BEGIN - DROP TEMPORARY TABLE IF EXISTS iva_group; - DROP TEMPORARY TABLE IF EXISTS iva_tax; - END; - - SIGNAL clean; - DROP TEMPORARY TABLE IF EXISTS ticket_iva; - - SET billing_date = IFNULL(billing_date, CURDATE()); - - -- Calcula el tipo de IVA para cada grupo en cada país. - - CREATE TEMPORARY TABLE iva_group - (INDEX idx USING HASH (Id_Pais, iva_group_id)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT Id_Pais, iva_group_id, c.tipo - FROM iva_group_codigo g - JOIN iva_codigo c ON g.iva_codigo_id = c.id - JOIN iva_tipo t ON t.id = c.iva_tipo_id - WHERE date <= billing_date - ORDER BY date DESC - ) t - GROUP BY Id_Pais, iva_group_id; - - -- Calcula el impuesto para cada tipo de IVA en cada país. - - CREATE TEMPORARY TABLE iva_tax - (INDEX idx USING HASH (Id_Pais, tipo)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT Id_Pais, tipo, iva * 0.01 AS iva, recargo * 0.01 AS re - FROM iva_codigo - JOIN iva_tipo t ON t.id = iva_tipo_id - WHERE Fecha <= billing_date -- AND iva jgf 2016-06-09 fallaba con los articulos exentos de iva - ORDER BY fecha DESC, recargo DESC - ) t - GROUP BY Id_Pais, tipo; - - -- Calcula el IVA y el recargo desglosado para cada ticket. + CALL vn.ticketGetTax (vBillingDate); CREATE TEMPORARY TABLE ticket_iva - (INDEX idx USING HASH (ticket_id)) - ENGINE = MEMORY - SELECT ticket_id, b.tipo, bi, IF(has_iva, red(bi * iva), 0) iva, IF(has_re, red(bi * i.re), 0) re - FROM ( - SELECT ticket_id, g.Id_Pais, g.tipo - ,SUM(red(m.Cantidad * m.Preu * (100 - m.Descuento) / 100)) AS bi - ,NOT(VIES AND p.pais_id <> c.Id_Pais) AS has_iva - ,RE != FALSE AS has_re - FROM ticket_tmp i - JOIN Tickets t ON t.Id_ticket = i.ticket_id - JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente - JOIN Proveedores p ON p.Id_Proveedor = t.empresa_id - JOIN Movimientos m ON m.Id_Ticket = i.ticket_id - JOIN Articles a USING(Id_Article) - JOIN iva_group g ON g.Id_Pais = p.pais_id AND g.iva_group_id = a.iva_group_id - GROUP BY ticket_id, tipo - ) b - JOIN iva_tax i ON i.Id_Pais = b.Id_Pais AND i.tipo = b.tipo; - - SIGNAL clean; + (INDEX (ticket_id)) + ENGINE = MEMORY + SELECT ticketFk ticket_id, type tipo, taxBase bi, tax iva, equalizationTax re + FROM tmp.ticketTax; + + DROP TEMPORARY TABLE + tmp.ticketTax, + tmp.ticket; 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 DROP PROCEDURE IF EXISTS `ticket_locator` */; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_locatorbetaKk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -37677,7 +38903,199 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_locator`(IN date_ DATETIME,IN wh_ INT, IN days TINYINT) +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_locatorbetaKk`(IN date_ DATETIME,IN wh_ INT, IN days TINYINT) +BEGIN + DECLARE DATEFEC DATE DEFAULT CURDATE(); + DECLARE v_date_start DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); + DECLARE v_date_end DATETIME DEFAULT TIMESTAMP(DATEFEC,'23:59:59'); + DECLARE v_date_future DATETIME DEFAULT TIMESTAMPADD(DAY,days,v_date_end); + + DROP TEMPORARY TABLE IF EXISTS `Locator`; + +-- usar ticket_total crear ticket_tmp(ticket_id) + DROP TEMPORARY TABLE IF EXISTS ticket_tmp; + CREATE TEMPORARY TABLE `ticket_tmp` + ENGINE = MEMORY + SELECT Id_Ticket ticket_id FROM Tickets t + WHERE t.Factura IS NULL + AND t.Fecha BETWEEN v_date_start AND v_date_future; + + CALL ticket_total(); + /* + DROP TEMPORARY TABLE IF EXISTS ticket_total2; + CREATE TEMPORARY TABLE `ticket_total2` + ENGINE = MEMORY + SELECT t.* FROM ticket_total t + LEFT JOIN Tickets t1 ON t1.Id_Ticket = t.ticket_id + LEFT JOIN Tickets_state ts ON ts.Id_Ticket = t1.Id_Ticket + LEFT JOIN vncontrol.inter i ON ts.inter_id = i.inter_id + LEFT JOIN state s ON s.id = i.state_id + LEFT JOIN expeditions e ON e.ticket_id = t.ticket_id + LEFT JOIN Agencias a ON a.Id_Agencia = t1.Id_Agencia + LEFT JOIN agency ag ON ag.agency_id = a.agency_id + LEFT JOIN agency_warehouse aw ON aw.agency_id = a.agency_id AND aw.warehouse_id = wh_ + -- para pte recogida + LEFT JOIN warehouse w_out on w_out.id = t1.warehouse_id + LEFT JOIN warehouse w ON w.id = wh_ + LEFT JOIN warehouse_pickup wp on wp.agency_id = t1.Id_Agencia and wp.warehouse_id = wh_ + + WHERE t1.Fecha BETWEEN TIMESTAMPADD(DAY,-5,DATE(date_)) AND TIMESTAMPADD(DAY,days,DATE(date_)) + AND IFNULL(aw.Vista,a.Vista) > 0 + AND ((t1.Anotadoencaja = FALSE + AND t1.Etiquetasemitidas = FALSE + AND e.ticket_id IS NULL + AND t1.warehouse_id = wh_ + AND IFNULL(s.order,0) < 2) + OR (ts.state_name = 'Pte Recogida' + AND wp.warehouse_id IS NOT NULL)); + */ + SELECT t.* FROM ticket_total t + LEFT JOIN Tickets t1 ON t1.Id_Ticket = t.ticket_id + LEFT JOIN Tickets_state ts ON ts.Id_Ticket = t1.Id_Ticket + LEFT JOIN vncontrol.inter i ON ts.inter_id = i.inter_id + LEFT JOIN state s ON s.id = i.state_id + LEFT JOIN expeditions e ON e.ticket_id = t.ticket_id + LEFT JOIN Agencias a ON a.Id_Agencia = t1.Id_Agencia + LEFT JOIN agency ag ON ag.agency_id = a.agency_id + LEFT JOIN agency_warehouse aw ON aw.agency_id = a.agency_id AND aw.warehouse_id = wh_ + -- para pte recogida + LEFT JOIN warehouse w_out on w_out.id = t1.warehouse_id + LEFT JOIN warehouse w ON w.id = wh_ + LEFT JOIN warehouse_pickup wp on wp.agency_id = t1.Id_Agencia and wp.warehouse_id = wh_ + + WHERE t1.Fecha BETWEEN TIMESTAMPADD(DAY,-5,DATE(date_)) AND TIMESTAMPADD(DAY,days,DATE(date_)) + AND IFNULL(aw.Vista,a.Vista) > 0 + AND ((t1.Anotadoencaja = FALSE + AND t1.Etiquetasemitidas = FALSE + AND e.ticket_id IS NULL)); + /* AND t1.warehouse_id = wh_ + AND IFNULL(s.order,0) < 2) + OR (ts.state_name = 'Pte Recogida' + AND wp.warehouse_id IS NOT NULL))*/ + /* + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + CREATE TEMPORARY TABLE tmp.risk + SELECT Id_Cliente, SUM(amount) risk + FROM Clientes c + JOIN ( + SELECT customer_id, SUM(amount) amount + FROM bi.customer_risk + GROUP BY customer_id + UNION ALL + SELECT Id_Cliente, SUM(Entregado) + FROM Recibos + WHERE Fechacobro > v_date_end + GROUP BY Id_Cliente + UNION ALL + SELECT t.Id_Cliente, SUM(total) + FROM ticket_total tt + JOIN Tickets t ON tt.ticket_id = t.Id_Ticket + WHERE t.Fecha <= v_date_end + GROUP BY t.Id_Cliente + UNION ALL + SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + WHERE t.receiptFk IS NULL + AND t.status = 'ok' + GROUP BY t.clientFk + ) t ON c.Id_Cliente = t.customer_id + WHERE c.activo != FALSE + GROUP BY c.Id_Cliente; + + CREATE TEMPORARY TABLE `Locator` + ENGINE = MEMORY + SELECT Congelado, Credito, risk Riesgo, Greuge, T.*,IFNULL(state_name,'libre') AS Estado, + Codigotrabajador, DATE(T.Fecha) AS Fecha_Simple, Averiguar_ComercialCliente_IdTicket(T.Id_Ticket) AS Comercial,C.calidad,UCASE(LEFT(w_out.`name`,5)) w_out + FROM Clientes C + INNER JOIN + ( + SELECT + t.Id_Ticket, t.Id_Cliente, t.warehouse_id, t.Fecha, t.Alias, + NULL Notas, t.Factura, t.factura_id, t.Anotadoencaja, t.Id_Consigna, t.Id_Trabajador, + t.Observaciones, t.Firmado, t.Etiquetasemitidas, t.PedidoImpreso, t.Bultos, t.Localizacion, + t.Hora, t.odbc_date, t.blocked, t.Solucion, t.Id_Ruta, t.Prioridad, t.priority, + t.empresa_id, t.Id_Agencia, + CS.Consignatario, IFNULL(aw.Vista,a.Vista) Vista,a.Agencia, DATEFEC AS Hora_MAX , + SUM(IF(Movimientos.OK = 0, 1, 0)) AS `lines`, + tt.total AS Importe, + IF(reino_id IN (5, 1), 0,tt.total) AS Plantas, + 0 AS inacabable, + CS.CODPOSTAL, CS.POBLACION, p.name PROVINCIA, a.Vista VistaTicket,p.zone + + FROM Tickets t + JOIN ticket_total2 tt ON tt.ticket_id = t.Id_Ticket + INNER JOIN Consignatarios CS USING(Id_Consigna) + LEFT JOIN province p USING(province_id) + LEFT JOIN Movimientos USING(Id_Ticket) + LEFT JOIN Articles on Movimientos.Id_Article = Articles.Id_Article + LEFT JOIN Tipos using(tipo_id) + LEFT JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia + LEFT JOIN agency ag ON ag.agency_id = a.agency_id + LEFT JOIN agency_warehouse aw ON aw.agency_id = a.agency_id AND aw.warehouse_id = wh_ + + GROUP BY t.Id_Ticket + ) T USING(Id_Cliente) + LEFT JOIN Tickets_state ts ON ts.Id_Ticket = T.Id_Ticket + LEFT JOIN Trabajadores Tb ON Tb.Id_Trabajador = T.Id_Trabajador + LEFT JOIN tmp.risk as Peligros USING(Id_Cliente) + JOIN warehouse w_out on w_out.id = T.warehouse_id + LEFT JOIN + ( + SELECT Id_Cliente, SUM(Importe) AS Greuge FROM Greuges + GROUP BY Id_Cliente + ) AS Agravios USING(Id_Cliente); + + + ALTER TABLE `Locator` ADD PRIMARY KEY(Id_Ticket); + + UPDATE `Locator` JOIN + ( + SELECT d.Id_Ticket from Tickets_dits d + JOIN Tickets t using(Id_Ticket) + LEFT JOIN Agencias a using(Id_Agencia) + LEFT JOIN expeditions e on e.ticket_id = d.Id_Ticket + WHERE Fecha BETWEEN CURDATE() AND TIMESTAMP(curdate(),'23:59:59') + AND idaccion_dits = 18 AND ticket_id is null + AND t.warehouse_id = 1 + AND NOT Etiquetasemitidas + AND d.ODBC_DATE < TIMESTAMPADD(HOUR,-2, now()) + AND Vista in (1,2)) sub using(Id_Ticket) + SET Observaciones = CONCAT('F5 PERDIDO ',IFNULL(Observaciones,'')); + + + -- ENTRADAS + INSERT INTO `Locator`(Fecha_Simple, Id_Ticket, Agencia, Id_Cliente, Alias, PedidoImpreso, CodigoTrabajador, Fecha, Estado, Consignatario, Vista, PROVINCIA,Riesgo) + SELECT DISTINCT v_compres.shipment AS Fecha_Simple, v_compres.Id_Entrada AS Id_Ticket, warehouse.name, v_compres.Id_Proveedor, + v_compres.ref AS Alias, v_compres.Pedida AS PedidoImpreso, v_compres.Id_Trabajador AS CodigoTrabajador, v_compres.shipment AS Fecha, 0 AS problem, v_compres.ref AS Consignatario, 1, 'TRASLADO',0 + FROM v_compres + INNER JOIN warehouse ON v_compres.warehouse_id = warehouse.id + WHERE warehouse_id_out = wh_ AND v_compres.Confirmada = False + AND v_compres.shipment >= date_; + + + +*/ + DROP TEMPORARY TABLE IF EXISTS ticket_tmp; + DROP TEMPORARY TABLE IF EXISTS ticket_total; + DROP TEMPORARY TABLE IF EXISTS ticket_total2; + DROP TEMPORARY TABLE IF EXISTS tmp.risk; +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 DROP PROCEDURE IF EXISTS `ticket_locatorkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_locatorkk`(date_ DATETIME, IN wh_ INT, IN days TINYINT) BEGIN DECLARE DATEFEC DATE DEFAULT CURDATE(); DECLARE v_date_start DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); @@ -37715,7 +39133,7 @@ BEGIN LEFT JOIN warehouse_pickup wp on wp.agency_id = t1.Id_Agencia and wp.warehouse_id = wh_ WHERE /*t1.Fecha BETWEEN TIMESTAMPADD(DAY,-5,DATE(date_)) AND TIMESTAMPADD(DAY,days,DATE(date_)) - AND */ IFNULL(aw.Vista,a.Vista) > 0 + AND */IFNULL(aw.Vista,a.Vista) > 0 AND ((t1.Anotadoencaja = FALSE AND t1.Etiquetasemitidas = FALSE AND e.ticket_id IS NULL @@ -37745,11 +39163,11 @@ BEGIN WHERE t.Fecha <= v_date_end GROUP BY t.Id_Cliente UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - WHERE t.receipt_id IS NULL + SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + WHERE t.receiptFk IS NULL AND t.status = 'ok' - GROUP BY t.customer_id + GROUP BY t.clientFk ) t ON c.Id_Cliente = t.customer_id WHERE c.activo != FALSE GROUP BY c.Id_Cliente; @@ -37847,7 +39265,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ticket_locatorbeta` */; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_locator_experimentalKk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -37857,199 +39275,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_locatorbeta`(IN date_ DATETIME,IN wh_ INT, IN days TINYINT) -BEGIN - DECLARE DATEFEC DATE DEFAULT CURDATE(); - DECLARE v_date_start DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); - DECLARE v_date_end DATETIME DEFAULT TIMESTAMP(DATEFEC,'23:59:59'); - DECLARE v_date_future DATETIME DEFAULT TIMESTAMPADD(DAY,days,v_date_end); - - DROP TEMPORARY TABLE IF EXISTS `Locator`; - --- usar ticket_total crear ticket_tmp(ticket_id) - DROP TEMPORARY TABLE IF EXISTS ticket_tmp; - CREATE TEMPORARY TABLE `ticket_tmp` - ENGINE = MEMORY - SELECT Id_Ticket ticket_id FROM Tickets t - WHERE t.Factura IS NULL - AND t.Fecha BETWEEN v_date_start AND v_date_future; - - CALL ticket_total(); - /* - DROP TEMPORARY TABLE IF EXISTS ticket_total2; - CREATE TEMPORARY TABLE `ticket_total2` - ENGINE = MEMORY - SELECT t.* FROM ticket_total t - LEFT JOIN Tickets t1 ON t1.Id_Ticket = t.ticket_id - LEFT JOIN Tickets_state ts ON ts.Id_Ticket = t1.Id_Ticket - LEFT JOIN vncontrol.inter i ON ts.inter_id = i.inter_id - LEFT JOIN state s ON s.id = i.state_id - LEFT JOIN expeditions e ON e.ticket_id = t.ticket_id - LEFT JOIN Agencias a ON a.Id_Agencia = t1.Id_Agencia - LEFT JOIN agency ag ON ag.agency_id = a.agency_id - LEFT JOIN agency_warehouse aw ON aw.agency_id = a.agency_id AND aw.warehouse_id = wh_ - -- para pte recogida - LEFT JOIN warehouse w_out on w_out.id = t1.warehouse_id - LEFT JOIN warehouse w ON w.id = wh_ - LEFT JOIN warehouse_pickup wp on wp.agency_id = t1.Id_Agencia and wp.warehouse_id = wh_ - - WHERE t1.Fecha BETWEEN TIMESTAMPADD(DAY,-5,DATE(date_)) AND TIMESTAMPADD(DAY,days,DATE(date_)) - AND IFNULL(aw.Vista,a.Vista) > 0 - AND ((t1.Anotadoencaja = FALSE - AND t1.Etiquetasemitidas = FALSE - AND e.ticket_id IS NULL - AND t1.warehouse_id = wh_ - AND IFNULL(s.order,0) < 2) - OR (ts.state_name = 'Pte Recogida' - AND wp.warehouse_id IS NOT NULL)); - */ - SELECT t.* FROM ticket_total t - LEFT JOIN Tickets t1 ON t1.Id_Ticket = t.ticket_id - LEFT JOIN Tickets_state ts ON ts.Id_Ticket = t1.Id_Ticket - LEFT JOIN vncontrol.inter i ON ts.inter_id = i.inter_id - LEFT JOIN state s ON s.id = i.state_id - LEFT JOIN expeditions e ON e.ticket_id = t.ticket_id - LEFT JOIN Agencias a ON a.Id_Agencia = t1.Id_Agencia - LEFT JOIN agency ag ON ag.agency_id = a.agency_id - LEFT JOIN agency_warehouse aw ON aw.agency_id = a.agency_id AND aw.warehouse_id = wh_ - -- para pte recogida - LEFT JOIN warehouse w_out on w_out.id = t1.warehouse_id - LEFT JOIN warehouse w ON w.id = wh_ - LEFT JOIN warehouse_pickup wp on wp.agency_id = t1.Id_Agencia and wp.warehouse_id = wh_ - - WHERE t1.Fecha BETWEEN TIMESTAMPADD(DAY,-5,DATE(date_)) AND TIMESTAMPADD(DAY,days,DATE(date_)) - AND IFNULL(aw.Vista,a.Vista) > 0 - AND ((t1.Anotadoencaja = FALSE - AND t1.Etiquetasemitidas = FALSE - AND e.ticket_id IS NULL)); - /* AND t1.warehouse_id = wh_ - AND IFNULL(s.order,0) < 2) - OR (ts.state_name = 'Pte Recogida' - AND wp.warehouse_id IS NOT NULL))*/ - /* - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - CREATE TEMPORARY TABLE tmp.risk - SELECT Id_Cliente, SUM(amount) risk - FROM Clientes c - JOIN ( - SELECT customer_id, SUM(amount) amount - FROM bi.customer_risk - GROUP BY customer_id - UNION ALL - SELECT Id_Cliente, SUM(Entregado) - FROM Recibos - WHERE Fechacobro > v_date_end - GROUP BY Id_Cliente - UNION ALL - SELECT t.Id_Cliente, SUM(total) - FROM ticket_total tt - JOIN Tickets t ON tt.ticket_id = t.Id_Ticket - WHERE t.Fecha <= v_date_end - GROUP BY t.Id_Cliente - UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - WHERE t.receipt_id IS NULL - AND t.status = 'ok' - GROUP BY t.customer_id - ) t ON c.Id_Cliente = t.customer_id - WHERE c.activo != FALSE - GROUP BY c.Id_Cliente; - - CREATE TEMPORARY TABLE `Locator` - ENGINE = MEMORY - SELECT Congelado, Credito, risk Riesgo, Greuge, T.*,IFNULL(state_name,'libre') AS Estado, - Codigotrabajador, DATE(T.Fecha) AS Fecha_Simple, Averiguar_ComercialCliente_IdTicket(T.Id_Ticket) AS Comercial,C.calidad,UCASE(LEFT(w_out.`name`,5)) w_out - FROM Clientes C - INNER JOIN - ( - SELECT - t.Id_Ticket, t.Id_Cliente, t.warehouse_id, t.Fecha, t.Alias, - NULL Notas, t.Factura, t.factura_id, t.Anotadoencaja, t.Id_Consigna, t.Id_Trabajador, - t.Observaciones, t.Firmado, t.Etiquetasemitidas, t.PedidoImpreso, t.Bultos, t.Localizacion, - t.Hora, t.odbc_date, t.blocked, t.Solucion, t.Id_Ruta, t.Prioridad, t.priority, - t.empresa_id, t.Id_Agencia, - CS.Consignatario, IFNULL(aw.Vista,a.Vista) Vista,a.Agencia, DATEFEC AS Hora_MAX , - SUM(IF(Movimientos.OK = 0, 1, 0)) AS `lines`, - tt.total AS Importe, - IF(reino_id IN (5, 1), 0,tt.total) AS Plantas, - 0 AS inacabable, - CS.CODPOSTAL, CS.POBLACION, p.name PROVINCIA, a.Vista VistaTicket,p.zone - - FROM Tickets t - JOIN ticket_total2 tt ON tt.ticket_id = t.Id_Ticket - INNER JOIN Consignatarios CS USING(Id_Consigna) - LEFT JOIN province p USING(province_id) - LEFT JOIN Movimientos USING(Id_Ticket) - LEFT JOIN Articles on Movimientos.Id_Article = Articles.Id_Article - LEFT JOIN Tipos using(tipo_id) - LEFT JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia - LEFT JOIN agency ag ON ag.agency_id = a.agency_id - LEFT JOIN agency_warehouse aw ON aw.agency_id = a.agency_id AND aw.warehouse_id = wh_ - - GROUP BY t.Id_Ticket - ) T USING(Id_Cliente) - LEFT JOIN Tickets_state ts ON ts.Id_Ticket = T.Id_Ticket - LEFT JOIN Trabajadores Tb ON Tb.Id_Trabajador = T.Id_Trabajador - LEFT JOIN tmp.risk as Peligros USING(Id_Cliente) - JOIN warehouse w_out on w_out.id = T.warehouse_id - LEFT JOIN - ( - SELECT Id_Cliente, SUM(Importe) AS Greuge FROM Greuges - GROUP BY Id_Cliente - ) AS Agravios USING(Id_Cliente); - - - ALTER TABLE `Locator` ADD PRIMARY KEY(Id_Ticket); - - UPDATE `Locator` JOIN - ( - SELECT d.Id_Ticket from Tickets_dits d - JOIN Tickets t using(Id_Ticket) - LEFT JOIN Agencias a using(Id_Agencia) - LEFT JOIN expeditions e on e.ticket_id = d.Id_Ticket - WHERE Fecha BETWEEN CURDATE() AND TIMESTAMP(curdate(),'23:59:59') - AND idaccion_dits = 18 AND ticket_id is null - AND t.warehouse_id = 1 - AND NOT Etiquetasemitidas - AND d.ODBC_DATE < TIMESTAMPADD(HOUR,-2, now()) - AND Vista in (1,2)) sub using(Id_Ticket) - SET Observaciones = CONCAT('F5 PERDIDO ',IFNULL(Observaciones,'')); - - - -- ENTRADAS - INSERT INTO `Locator`(Fecha_Simple, Id_Ticket, Agencia, Id_Cliente, Alias, PedidoImpreso, CodigoTrabajador, Fecha, Estado, Consignatario, Vista, PROVINCIA,Riesgo) - SELECT DISTINCT v_compres.shipment AS Fecha_Simple, v_compres.Id_Entrada AS Id_Ticket, warehouse.name, v_compres.Id_Proveedor, - v_compres.ref AS Alias, v_compres.Pedida AS PedidoImpreso, v_compres.Id_Trabajador AS CodigoTrabajador, v_compres.shipment AS Fecha, 0 AS problem, v_compres.ref AS Consignatario, 1, 'TRASLADO',0 - FROM v_compres - INNER JOIN warehouse ON v_compres.warehouse_id = warehouse.id - WHERE warehouse_id_out = wh_ AND v_compres.Confirmada = False - AND v_compres.shipment >= date_; - - - -*/ - DROP TEMPORARY TABLE IF EXISTS ticket_tmp; - DROP TEMPORARY TABLE IF EXISTS ticket_total; - DROP TEMPORARY TABLE IF EXISTS ticket_total2; - DROP TEMPORARY TABLE IF EXISTS tmp.risk; -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 DROP PROCEDURE IF EXISTS `ticket_locator_experimental` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_locator_experimental`(IN date_ DATETIME,IN wh_ INT, IN days TINYINT) +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_locator_experimentalKk`(IN date_ DATETIME,IN wh_ INT, IN days TINYINT) BEGIN DECLARE DATEFEC DATE DEFAULT CURDATE(); DECLARE v_date_start DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); @@ -38126,11 +39352,11 @@ BEGIN WHERE t.Fecha <= v_date_end GROUP BY t.Id_Cliente UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - WHERE t.receipt_id IS NULL + SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + WHERE t.receiptFk IS NULL AND t.status = 'ok' - GROUP BY t.customer_id + GROUP BY t.clientFk ) t ON c.Id_Cliente = t.customer_id WHERE c.activo != FALSE GROUP BY c.Id_Cliente; @@ -38483,20 +39709,19 @@ BEGIN /** * Calcula el total con IVA de un conjunto de tickets. * - * @param table ticket_tmp(ticket_id) Tabla con el listado de tickets + * @deprecated Use procedure vn.ticketGetTotal() instead * + * @table ticket_tmp(ticket_id) Tabla con el listado de tickets * @return table ticket_total - **/ - - DROP TEMPORARY TABLE IF EXISTS ticket_total; - + */ CALL ticket_iva (NULL); + DROP TEMPORARY TABLE IF EXISTS ticket_total; CREATE TEMPORARY TABLE ticket_total - (INDEX idx USING HASH (ticket_id)) - ENGINE = MEMORY - SELECT ticket_id, red(SUM(bi + iva + re)) AS total - FROM ticket_iva GROUP BY ticket_id; + (INDEX (ticket_id)) + ENGINE = MEMORY + SELECT ticket_id, red(SUM(bi + iva + re)) AS total + FROM ticket_iva GROUP BY ticket_id; DROP TEMPORARY TABLE ticket_iva; END ;; @@ -38523,23 +39748,18 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS ticket_volumen; SELECT warehouse_id, Fecha INTO intWh,datFecha FROM Tickets WHERE Id_Ticket = idT; - CALL item_last_buy_(intWh,datFecha); - CREATE TEMPORARY TABLE IF NOT EXISTS ticket_volumen ENGINE MEMORY SELECT Id_Article,Cantidad, Concepte, VolUd as m3_uni, Volumen as m3, @m3:= @m3 + ifnull(Volumen,0) as m3_total FROM ( - SELECT round(cm3(Id_Compra)/1000000/Packing,3) as VolUd ,M.Cantidad,round(M.Cantidad * cm3(Id_Compra)/1000000/Packing,3) as Volumen, + SELECT round(r.cm3 / 1000000,3) as VolUd ,M.Cantidad, round(r.cm3 * M.Cantidad / 1000000,3) as Volumen, M.Id_Article, Concepte, @m3:= 0, @vol:=0, Id_Agencia FROM Movimientos M - JOIN t_item_last_buy b on M.Id_Article = b.item_id - JOIN Compres C ON C.Id_Compra = b.buy_id JOIN Tickets T on T.Id_Ticket = M.Id_Ticket + JOIN bi.rotacion r ON r.Id_Article = M.Id_Article AND r.warehouse_id = T.warehouse_id WHERE M.Id_Ticket = idT - ) sub - JOIN Agencias a using(Id_Agencia); + ) sub; - DROP TEMPORARY TABLE t_item_last_buy; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38776,7 +39996,6 @@ BEGIN DECLARE v_calc_available INTEGER; DECLARE v_calc_visible INTEGER; - 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 @@ -38891,7 +40110,9 @@ BEGIN C.Packing PackingOrigin, - C.Id_Compra CompraOrigin + C.Id_Compra CompraOrigin, + + CB.costeRetorno FROM Articles ar LEFT JOIN tmp_item AIM ON AIM.item_id = ar.Id_Article @@ -38933,7 +40154,7 @@ BEGIN MOD(Cantidad , grouping) as Soll, - (IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing as cm3, + ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing,0) as cm3, Costefijo + Comisionfija + Portefijo AS Cost, @@ -38941,7 +40162,7 @@ BEGIN @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, - @embalaje := IF(Retornable != 0, 0,ROUND(Valor / Packing,3)) AS Embalaje, + 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, @@ -39161,6 +40382,213 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS Traslados; +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 DROP PROCEDURE IF EXISTS `trasladoKK` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `trasladoKK`(IN i_entrada INTEGER) +BEGIN + DECLARE dateShipment DATE; + DECLARE dateLanding DATE; + DECLARE warehouseShipment INTEGER; + DECLARE warehouseLanding INTEGER; + DECLARE v_calc_available INTEGER; + DECLARE v_calc_visible INTEGER; + + + 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 buy_tarifas_table(i_entrada); + + -- Traslado en almacen origen + + DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; + + CREATE TEMPORARY TABLE buy_edi_temp + (KEY (Id_Article)) 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 date_inv() AND dateShipment + AND c.Novincular = FALSE + AND c.Tarifa2 >= 0 + ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC) t + GROUP BY Id_Article; + + IF dateShipment >= CURDATE() THEN + + CALL availableTraslate(warehouseShipment, dateShipment,NULL); + CALL `cache`.visible_refresh(v_calc_visible,TRUE,warehouseShipment); + DROP TEMPORARY TABLE IF EXISTS tmp_item; + CREATE TEMPORARY TABLE tmp_item (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY + SELECT item_id, visible,0 available FROM `cache`.visible WHERE calc_id = v_calc_visible; + INSERT INTO tmp_item(item_id, available) + SELECT a.item_id, a.available FROM availableTraslate a + ON DUPLICATE KEY UPDATE available = a.available; + ELSE + CALL item_stock(warehouseShipment, dateShipment,NULL); + END IF; + + 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, + + 0 as vis2, + + 0 as dis2, + + IFNULL(CE.grouping,C.grouping) as grouping, + + IFNULL(CE.Packing,C.Packing) as Packing, + + IFNULL(CE.caja,C.caja) as caja, + + IFNULL(C.Productor, P2.Alias) AS Productor, + + C.Id_Cubo, + + 1 Tinta, + + CE.Id_Compra, + + CE.Etiquetas, + + C.buy_edi_id, + + tp.Id_Trabajador, + + CB.Volumen, + + CB.x, CB.y, CB.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, + + t3, t2, tp.promo, + + C.grouping groupingOrigin, + + C.Packing PackingOrigin, + + C.Id_Compra CompraOrigin + + FROM Articles ar + LEFT JOIN tmp_item AIM ON AIM.item_id = ar.Id_Article + LEFT JOIN Tipos tp ON tp.tipo_id = ar.tipo_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 tblTARIFAS ON TRUE + WHERE tp.reino_id <> 6 AND tp.reino_id <> 8 + AND E.Redada = FALSE; + + CREATE INDEX tindex USING HASH ON Traslados (article_id); + +-- Inventario en el warehouse destino + IF dateShipment >= CURDATE() THEN + + CALL cache.visible_refresh(v_calc_visible, TRUE, warehouseLanding); + CALL availableTraslate(warehouseLanding, dateLanding,warehouseShipment); + + UPDATE Traslados t + LEFT JOIN availableTraslate a ON t.article_id = a.item_id + LEFT JOIN `cache`.visible v ON v.calc_id = v_calc_visible AND t.article_id = v.item_id + SET vis2 = v.visible, dis2 = a.available; + + END IF; +-- --------------------------------------------- + + SELECT t.*, + + Cantidad - MOD(Cantidad , grouping) as Subcantidad, + + MOD(Cantidad , grouping) as Soll, + + (IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing 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, + + @embalaje := IF(Retornable != 0, 0,ROUND(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 + WHERE vis1 <> 0 OR dis1 <> 0 OR vis2 <> 0 OR dis2 <> 0 + ORDER BY tipo_id, Article, Medida, Categoria, Origen; + + DROP TEMPORARY TABLE IF EXISTS Traslados; + DROP TEMPORARY TABLE IF EXISTS tmp_item; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39747,18 +41175,20 @@ SELECT wo.name as OrigenCajas, tr.landing, w.name as Destino, - NULL as Etiquetas, + sum(c.Etiquetas) as Etiquetas, NULL as Notas_Eva, kg, - cast(sum(tp.density * c.Etiquetas * IF(cb.Volumen, cb.Volumen, cb.X * cb.Y * cb.Z) / 1000000 ) as DECIMAL(10,0)) as loadedKg, + cast(sum(a.density * c.Etiquetas * IF(cb.Volumen, cb.Volumen, cb.X * cb.Y * cb.Z) / 1000000 ) as DECIMAL(10,0)) as loadedKg, NULL as loadPriority, - NULL as awb + NULL as Notas, + pc.Proveedor as Carguera FROM travel tr - JOIN Entradas e ON e.travel_id = tr.id - 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 + 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 @@ -39780,20 +41210,23 @@ SELECT sum(Etiquetas) as Etiquetas, e.Notas_Eva, NULL as kg, - cast(sum(tp.density * c.Etiquetas * IF(cb.Volumen, cb.Volumen, cb.X * cb.Y * cb.Z) / 1000000 ) as DECIMAL(10,0)) as loadedkg, + cast(sum(a.density * c.Etiquetas * IF(cb.Volumen, cb.Volumen, cb.X * cb.Y * cb.Z) / 1000000 ) as DECIMAL(10,0)) as loadedkg, loadPriority, - CAST(awb.codigo AS DECIMAL(11,0)) as awb + -- CAST(awb.codigo AS DECIMAL(11,0)) as awb, + e.Notas, + pc.Proveedor as carguera FROM Entradas e - LEFT JOIN recibida_entrada re ON re.Id_Entrada = e.Id_Entrada + /* LEFT JOIN recibida_entrada re ON re.Id_Entrada = e.Id_Entrada LEFT JOIN awb_recibida ar ON ar.recibida_id = re.awb_recibida LEFT JOIN awb ON awb.id = ar.awb_id - JOIN Compres c ON c.Id_Entrada = e.Id_Entrada + */ 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 WHERE tr.landing >= vDateFrom @@ -40092,9 +41525,9 @@ WHILE NOT done DO SELECT LAST_INSERT_ID() INTO myNuevaEntrada; INSERT INTO Compres(Id_Entrada, Id_Article, Cantidad, Costefijo, Portefijo, Embalajefijo, Novincular, Comisionfija, Etiquetas, Packing - ,grouping, caja, /*container_id, */ Nicho, Id_Cubo, Tarifa1,Tarifa2,Tarifa3, PVP, Productor) + ,grouping, caja, /*container_id, */Nicho, Id_Cubo, Tarifa1,Tarifa2,Tarifa3, PVP, Productor) SELECT myNuevaEntrada, Id_Article, Cantidad, Costefijo, Portefijo, Embalajefijo, Novincular, Comisionfija, Etiquetas, Packing - ,grouping, caja,/* container_id, */ Nicho, Id_Cubo, Tarifa1,Tarifa2,Tarifa3, PVP, Productor + ,grouping, caja,/* container_id, */Nicho, Id_Cubo, Tarifa1,Tarifa2,Tarifa3, PVP, Productor FROM Compres WHERE Id_Entrada = myEntrada; @@ -40161,7 +41594,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ubicator`(IN i_wh TINYINT, IN d_fecha DATE,IN filtro VARCHAR(255)) BEGIN @@ -40224,7 +41657,7 @@ SELECT Id_Article article_id,SUM(Cantidad) amount FROM ( SELECT * from stock_actual;*/ -- TEMPORARY -CALL hedera.sql_query (sql_printf(' +CALL util.exec (sql_printf(' CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.tmp_ubicator_stock AS SELECT A.Id_Article,A.Article, T.Id_Cubo,IF(Z > 0,Z,0) as z,x,y, CEIL(S.Suma/T.packing) as etiquetas,A.Medida,A.Nicho @@ -40813,7 +42246,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ubicator_test`(IN i_wh TINYINT, IN d_fecha DATE,IN filtro VARCHAR(255)) BEGIN @@ -40864,7 +42297,7 @@ SELECT Id_Article article_id,SUM(Cantidad) amount FROM ( SELECT * from stock_actual;*/ -- TEMPORARY -CALL hedera.sql_query (sql_printf(' +CALL util.exec (sql_printf(' CREATE TEMPORARY TABLE IF NOT EXISTS vn2008.tmp_ubicator_stock AS SELECT A.Id_Article,A.Article, T.Id_Cubo,IF(Z > 0,Z,0) as z,x,y, CEIL(S.Suma/T.grouping) as etiquetas,A.Medida,A.Nicho @@ -41224,6 +42657,161 @@ SELECT *,Cantidad * price as total FROM item; DROP TEMPORARY TABLE item; +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 DROP PROCEDURE IF EXISTS `valuatedInventory` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `valuatedInventory`(IN vDate DATE, IN vIsItemised BOOLEAN) +BEGIN + + DECLARE vLastInventoryDate DATE; + + SELECT landing INTO vLastInventoryDate + FROM travel TR + INNER JOIN Entradas E ON E.travel_id = TR.id + WHERE landing <= vDate + AND E.Id_Proveedor = 4 + ORDER BY landing DESC + LIMIT 1; + + DROP TEMPORARY TABLE IF EXISTS inv; + + CREATE TEMPORARY TABLE inv + (warehouseFk SMALLINT, + itemFk BIGINT, + amount INT, + cost DOUBLE DEFAULT 0, + total DOUBLE DEFAULT 0) + ENGINE = MEMORY; + + ALTER TABLE inv ADD PRIMARY KEY USING HASH (warehouseFk, itemFk); + + -- Valor del inventario + INSERT INTO inv(warehouseFk, itemFk, amount) + SELECT TR.warehouse_id, C.Id_Article, C.Cantidad + FROM Compres C + JOIN Articles A USING(Id_Article) + JOIN Entradas E USING (Id_Entrada) + JOIN travel TR ON TR.id = E.travel_id + JOIN Tipos t USING(tipo_id) + JOIN warehouse w ON w.id = TR.warehouse_id + WHERE landing = vLastInventoryDate + AND E.Id_Proveedor = 4 + AND reino_id NOT IN (7) + ON DUPLICATE KEY UPDATE inv.amount = inv.amount + C.Cantidad; + + -- Añadimos compras + INSERT INTO inv(warehouseFk, itemFk, amount) + SELECT TR.warehouse_id, C.Id_Article, C.Cantidad + FROM Compres C + INNER JOIN Articles A USING(Id_Article) + INNER JOIN Entradas E USING (Id_Entrada) + INNER JOIN travel TR ON TR.id = E.travel_id + INNER JOIN Tipos t USING(tipo_id) + INNER JOIN warehouse w ON w.id = TR.warehouse_id + WHERE landing BETWEEN vLastInventoryDate AND vDate + AND NOT redada + AND NOT w.fuente + AND reino_id NOT IN (7) + AND t.inventory + ON DUPLICATE KEY UPDATE inv.amount = inv.amount + C.Cantidad; + + -- Restamos salidas + INSERT INTO inv(warehouseFk, itemFk, amount) + SELECT TR.warehouse_id_out, C.Id_Article, - C.Cantidad + FROM Compres C + INNER JOIN Articles A USING(Id_Article) + INNER JOIN Entradas E USING (Id_Entrada) + INNER JOIN travel TR ON TR.id = E.travel_id + INNER JOIN Tipos t USING(tipo_id) + INNER JOIN warehouse w ON w.id = warehouse_id_out + WHERE shipment BETWEEN vLastInventoryDate AND vDate + AND NOT redada + AND NOT w.fuente + AND reino_id NOT IN (7) + AND t.inventory + ON DUPLICATE KEY UPDATE inv.amount = inv.amount - C.Cantidad; + + -- Restamos ventas + INSERT INTO inv(warehouseFk, itemFk, amount) + SELECT w.id, M.Id_Article, - M.Cantidad + FROM Movimientos M + INNER JOIN Tickets T USING (Id_Ticket) + INNER JOIN Clientes C USING(Id_Cliente) + INNER JOIN Articles A USING(Id_Article) + INNER JOIN Tipos t USING(tipo_id) + INNER JOIN warehouse w ON w.id = warehouse_id + WHERE T.Fecha BETWEEN vLastInventoryDate AND TIMESTAMPADD(DAY, -1 ,vDate) + AND NOT w.fuente + AND reino_id NOT IN (7) + AND t.inventory + ON DUPLICATE KEY UPDATE inv.amount = inv.amount - M.Cantidad; + + -- Restamos el dia de hoy + INSERT INTO inv(warehouseFk, itemFk, amount) + SELECT w.id, M.Id_Article, - M.Cantidad + FROM Movimientos M + INNER JOIN Tickets T USING (Id_Ticket) + INNER JOIN Clientes C USING(Id_Cliente) + INNER JOIN Articles A USING(Id_Article) + INNER JOIN Tipos t USING(tipo_id) + INNER JOIN warehouse w ON w.id = warehouse_id + WHERE date(T.Fecha) = vDate + AND (vDate <> CURDATE() or (M.OK <> 0 or T.Etiquetasemitidas <> 0 )) + AND NOT w.fuente + AND reino_id NOT IN (7) + AND t.inventory + ON DUPLICATE KEY UPDATE inv.amount = inv.amount - M.Cantidad ; + + CALL item_last_buy_from_interval(NULL,vLastInventoryDate,vDate); + + UPDATE inv + JOIN tmp.item_last_buy_from_interval lb + ON inv.warehouseFk = lb.warehouse_id AND inv.itemFk = lb.item_id + JOIN Compres C ON C.Id_Compra = lb.buy_id + SET total = inv.amount * (ifnull(C.Costefijo,0) + IFNULL(C.Embalajefijo,0) + IFNULL(C.Portefijo,0) + IFNULL(C.Comisionfija,0)), + cost = ifnull(C.Costefijo,0) + IFNULL(C.Embalajefijo,0) + IFNULL(C.Portefijo,0) + IFNULL(C.Comisionfija,0) + WHERE inv.amount <> 0; + + DELETE FROM inv WHERE amount IS NULL or amount = 0; + + IF vIsItemised THEN + + SELECT inv.warehouseFk, a.Id_Article, a.Article, a.Medida, inv.amount, tp.Id_Tipo, + tp.reino_id, inv.cost, cast(inv.total as decimal(10,2)) total, an.nicho + FROM inv + JOIN warehouse w on w.id = inv.warehouseFk + JOIN Articles a ON a.Id_Article = inv.itemFk + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + JOIN Articles_nicho an ON an.Id_Article = a.Id_Article AND an.warehouse_id = w.id + where w.valuatedInventory + and inv.total > 0 + order by inv.total desc; + + ELSE + + SELECT w.name as Almacen, r.reino as Reino, cast(inv.total as decimal) as Euros + FROM inv + JOIN warehouse w ON w.id = inv.warehouseFk + JOIN Articles A ON A.Id_Article = inv.itemFk + JOIN Tipos t ON t.tipo_id = A.tipo_id + JOIN reinos r ON r.id = t.reino_id + WHERE w.valuatedInventory; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41313,27 +42901,21 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vips_in_a_week`(IN strCONDITION varchar(512)) -BEGIN -call sql_query( CONCAT('SELECT C.Id_Cliente, C.Cliente, RED(SUM((M.Cantidad * M.Preu) * 100 - M.Descuento) / 100) as Importe - FROM Clientes C INNER JOIN Tickets T ON T.Id_Cliente = C.Id_Cliente - INNER JOIN Movimientos M ON M.Id_Ticket = T.Id_Ticket - INNER JOIN Articles A ON A.Id_Article = M.Id_Article - JOIN Tipos TP ON A.tipo_id = TP.tipo_id - INNER JOIN Trabajadores TR ON TR.Id_Trabajador = TP.Id_Trabajador - WHERE ', - - strCONDITION, - - - ' GROUP BY Id_Cliente - HAVING Importe > 0 - ORDER BY Importe DESC - ') - - -); - +CREATE DEFINER=`root`@`%` PROCEDURE `vips_in_a_week`(vCondition VARCHAR(512)) +BEGIN + CALL util.exec (CONCAT( + 'SELECT C.Id_Cliente, C.Cliente, RED(SUM((M.Cantidad * M.Preu) * 100 - M.Descuento) / 100) as Importe + FROM vn2008.Clientes C + JOIN vn2008.Tickets T ON T.Id_Cliente = C.Id_Cliente + JOIN vn2008.Movimientos M ON M.Id_Ticket = T.Id_Ticket + JOIN vn2008.Articles A ON A.Id_Article = M.Id_Article + JOIN vn2008.Tipos TP ON A.tipo_id = TP.tipo_id + JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = TP.Id_Trabajador + WHERE ', vCondition, ' + GROUP BY Id_Cliente + HAVING Importe > 0 + ORDER BY Importe DESC' + )); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41350,26 +42932,21 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `vips_in_a_week_by_client`(IN strCONDITION varchar(512)) +CREATE DEFINER=`root`@`%` PROCEDURE `vips_in_a_week_by_client`(vCondition VARCHAR(512)) BEGIN - -call sql_query( CONCAT('SELECT M.Id_Article, A.Article, A.Medida, A.Color, A.Categoria, - SUM(M.Cantidad) Cantidad, M.Preu, M.Descuento, - RED(SUM(M.Cantidad) * M.Preu * (100 - M.Descuento) / 100) as Importe - FROM Clientes C INNER JOIN Tickets T ON T.Id_Cliente = C.Id_Cliente - INNER JOIN Movimientos M ON M.Id_Ticket = T.Id_Ticket - INNER JOIN Articles A ON A.Id_Article = M.Id_Article - JOIN Tipos TP ON A.tipo_id = TP.tipo_id - INNER JOIN Trabajadores TR ON TR.Id_Trabajador = TP.Id_Trabajador - WHERE ', - - strCONDITION, - - ' GROUP BY M.Id_Article, A.Article, A.Medida, A.Color, A.Categoria, M.Preu, M.Descuento ' - - ) - ); - + CALL util.exec (CONCAT( + 'SELECT M.Id_Article, A.Article, A.Medida, A.Color, A.Categoria, + SUM(M.Cantidad) Cantidad, M.Preu, M.Descuento, + RED(SUM(M.Cantidad) * M.Preu * (100 - M.Descuento) / 100) as Importe + FROM vn2008.Clientes C + JOIN vn2008.Tickets T ON T.Id_Cliente = C.Id_Cliente + JOIN vn2008.Movimientos M ON M.Id_Ticket = T.Id_Ticket + JOIN vn2008.Articles A ON A.Id_Article = M.Id_Article + JOIN vn2008.Tipos TP ON A.tipo_id = TP.tipo_id + JOIN vn2008.Trabajadores TR ON TR.Id_Trabajador = TP.Id_Trabajador + WHERE ', vCondition, ' + GROUP BY M.Id_Article, A.Article, A.Medida, A.Color, A.Categoria, M.Preu, M.Descuento' + )); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41387,43 +42964,43 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `volumetricoReparto`( IN IdTicket INT(11), OUT atot DOUBLE ) -BEGIN - - DECLARE ticket INT(11); - - DECLARE rutaid INT(11); - - DECLARE art INT(11); - - DECLARE ax, ay, az, atot double; - - DECLARE CUR1 CURSOR FOR SELECT a.Id_Article FROM vn2008.Movimientos m, vn2008.Articles a - WHERE m.Id_Ticket = IdTicket AND m.Id_Article = a.Id_Article ; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET @atot = 0; - - set @atot = 0; - - OPEN CUR1; - - REPEAT - - FETCH CUR1 INTO art ; - - SELECT x, y, z into ax,ay,az - FROM vn2008.Cubos cu, vn2008.Compres co - WHERE cu.Id_Cubo = co.Id_Cubo AND Id_Compra = - (SELECT max(Id_Compra) FROM vn2008.Compres c - WHERE c.Id_Article = @art); - - set @atot = @atot +((@ax * @ay * @az)* 1,10); - - UNTIL done END REPEAT; - CLOSE CUR1; - - - select 'hola ',@atot; - +BEGIN + + DECLARE ticket INT(11); + + DECLARE rutaid INT(11); + + DECLARE art INT(11); + + DECLARE ax, ay, az, atot double; + + DECLARE CUR1 CURSOR FOR SELECT a.Id_Article FROM vn2008.Movimientos m, vn2008.Articles a + WHERE m.Id_Ticket = IdTicket AND m.Id_Article = a.Id_Article ; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET @atot = 0; + + set @atot = 0; + + OPEN CUR1; + + REPEAT + + FETCH CUR1 INTO art ; + + SELECT x, y, z into ax,ay,az + FROM vn2008.Cubos cu, vn2008.Compres co + WHERE cu.Id_Cubo = co.Id_Cubo AND Id_Compra = + (SELECT max(Id_Compra) FROM vn2008.Compres c + WHERE c.Id_Article = @art); + + set @atot = @atot +((@ax * @ay * @az)* 1,10); + + UNTIL done END REPEAT; + CLOSE CUR1; + + + select 'hola ',@atot; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41441,36 +43018,36 @@ DELIMITER ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `weekly_sales_new`(v_wh SMALLINT, v_date_ini DATETIME, v_date_end DATETIME) -BEGIN - IF v_date_end IS NULL THEN - SET v_date_end = v_date_ini; - END IF; - - SET v_date_end = TIMESTAMPADD(DAY, 1, v_date_end); - - CREATE TEMPORARY TABLE weekly_ticket - (INDEX idx USING HASH (Id_Ticket)) - ENGINE = MEMORY - SELECT Id_Ticket, to_weeks (DATE(Fecha)) week, warehouse_id - FROM Tickets t - JOIN warehouse w ON w.id = t.warehouse_id - WHERE Fecha >= v_date_ini AND Fecha < v_date_end - AND Id_Cliente NOT IN (400, 200) - AND NOT w.fuente - AND v_wh IN (t.warehouse_id, 0); - - CREATE TEMPORARY TABLE weekly_sales - ENGINE = MEMORY - SELECT week, warehouse_id, a.Id_Article item_id, SUM(Cantidad) AS amount, - SUM(Cantidad * Preu * (100 - Descuento) / 100) AS price - FROM Movimientos m - JOIN weekly_ticket t USING (Id_Ticket) - JOIN Articles a USING (Id_Article) - INNER JOIN Tipos USING (tipo_id) - WHERE reino_id != 6 - GROUP BY week, warehouse_id, item_id; - - DROP TEMPORARY TABLE weekly_ticket; +BEGIN + IF v_date_end IS NULL THEN + SET v_date_end = v_date_ini; + END IF; + + SET v_date_end = TIMESTAMPADD(DAY, 1, v_date_end); + + CREATE TEMPORARY TABLE weekly_ticket + (INDEX idx USING HASH (Id_Ticket)) + ENGINE = MEMORY + SELECT Id_Ticket, to_weeks (DATE(Fecha)) week, warehouse_id + FROM Tickets t + JOIN warehouse w ON w.id = t.warehouse_id + WHERE Fecha >= v_date_ini AND Fecha < v_date_end + AND Id_Cliente NOT IN (400, 200) + AND NOT w.fuente + AND v_wh IN (t.warehouse_id, 0); + + CREATE TEMPORARY TABLE weekly_sales + ENGINE = MEMORY + SELECT week, warehouse_id, a.Id_Article item_id, SUM(Cantidad) AS amount, + SUM(Cantidad * Preu * (100 - Descuento) / 100) AS price + FROM Movimientos m + JOIN weekly_ticket t USING (Id_Ticket) + JOIN Articles a USING (Id_Article) + INNER JOIN Tipos USING (tipo_id) + WHERE reino_id != 6 + GROUP BY week, warehouse_id, item_id; + + DROP TEMPORARY TABLE weekly_ticket; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41519,7 +43096,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `__camiones` */; +/*!50003 DROP PROCEDURE IF EXISTS `__abono` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -41529,1833 +43106,41 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `__camiones`(vWarehouse INT, vDate DATE) +CREATE DEFINER=`root`@`localhost` PROCEDURE `__abono`(IN idT MEDIUMINT, IN idUSER SMALLINT) BEGIN - CALL inventario_multiple_reservas(vDate, 7, 4848); - CALL article_multiple_buy(vDate, 7); - - SELECT Temperatura - ,ROUND(SUM(Etiquetas * cm3_2(Id_Cubo, Id_Article))) AS cm3 - ,ROUND(SUM(IF(scanned,Etiquetas,0) * cm3_2(Id_Cubo, Id_Article))) AS cm3s - ,ROUND(SUM(Vida * cm3_2(Id_Cubo, Id_Article))) AS cm3e - FROM ( - SELECT t.Temperatura, c.Etiquetas, c.Id_Cubo, c.Id_Article, b.scanned, c.Vida - FROM Compres c - LEFT JOIN buy_edi b ON b.id = c.buy_edi_id - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Tipos t ON t.tipo_id = a.tipo_id - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel tr ON tr.id = e.travel_id - WHERE tr.warehouse_id = vWarehouse - AND tr.landing = vDate - UNION ALL - SELECT t.Temperatura, @e:= ai.visible/c.packing, c.Id_Cubo, ai.article_id, @e, @e - FROM article_inventory ai - JOIN Compres c ON c.Id_Compra = ai.buy_id - JOIN Articles a ON a.Id_Article = ai.article_id - JOIN Tipos t ON t.tipo_id = a.tipo_id - WHERE avalaible > 0 - ) sub - GROUP BY Temperatura; - - DROP TEMPORARY TABLE article_inventory; -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 DROP PROCEDURE IF EXISTS `__sql_signal` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `__sql_signal`(v_code CHAR(35)) -BEGIN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = v_code; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Current Database: `bi` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; - -USE `bi`; - --- --- Table structure for table `Equalizator` --- - -DROP TABLE IF EXISTS `Equalizator`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Equalizator` ( - `Vista` int(11) NOT NULL, - `Pedido` int(11) DEFAULT NULL, - `Impreso` int(11) DEFAULT NULL, - `Encajado` int(11) DEFAULT NULL, - PRIMARY KEY (`Vista`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Greuge_Evolution` --- - -DROP TABLE IF EXISTS `Greuge_Evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Greuge_Evolution` ( - `Id_Cliente` int(11) NOT NULL, - `Fecha` date NOT NULL, - `Greuge` decimal(10,2) NOT NULL DEFAULT '0.00', - `Ventas` decimal(10,2) NOT NULL DEFAULT '0.00', - `Fosil` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'greuge fósil, correspondiente a los clientes muertos', - `Recobro` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`Id_Cliente`,`Fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacenamos la evolucion del greuge de los ultimos dias '; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Greuge_comercial_recobro` --- - -DROP TABLE IF EXISTS `Greuge_comercial_recobro`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Greuge_comercial_recobro` ( - `Id_Trabajador` int(11) NOT NULL, - `recobro` decimal(10,2) NOT NULL DEFAULT '0.00', - `peso_cartera` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`Id_Trabajador`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Greuges_comercial_detail` --- - -DROP TABLE IF EXISTS `Greuges_comercial_detail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Greuges_comercial_detail` ( - `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `Id_Trabajador` int(10) unsigned NOT NULL, - `Comentario` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `Importe` decimal(10,2) NOT NULL, - `Fecha` datetime DEFAULT NULL, - PRIMARY KEY (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Last_buy_id` --- - -DROP TABLE IF EXISTS `Last_buy_id`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Last_buy_id` ( - `Id_Article` int(11) NOT NULL DEFAULT '90', - `Id_Compra` int(11) NOT NULL DEFAULT '0', - `warehouse_id` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`warehouse_id`,`Id_Article`), - UNIQUE KEY `Id_Compra_UNIQUE` (`Id_Compra`), - CONSTRAINT `Id_CompraFK` FOREIGN KEY (`Id_Compra`) REFERENCES `vn2008`.`Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Last_buy_idBackUp` --- - -DROP TABLE IF EXISTS `Last_buy_idBackUp`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Last_buy_idBackUp` ( - `Id_Article` int(11) NOT NULL DEFAULT '90', - `Id_Compra` int(11) NOT NULL DEFAULT '0', - `warehouse_id` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`Id_Article`,`warehouse_id`), - UNIQUE KEY `Id_Compra_UNIQUE` (`Id_Compra`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Radar` --- - -DROP TABLE IF EXISTS `Radar`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Radar` ( - `Propio` int(1) NOT NULL DEFAULT '0', - `Credito` double NOT NULL DEFAULT '0', - `Riesgo` double(19,2) DEFAULT NULL, - `Greuge` double DEFAULT NULL, - `Id_Ticket` int(11) NOT NULL DEFAULT '0', - `wh` smallint(6) unsigned NOT NULL DEFAULT '1', - `Fecha` datetime NOT NULL, - `Alias` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `Vista` int(11) DEFAULT '0', - `Tipo` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'RECOGIDA', - `Id_Trabajador` int(11) DEFAULT '20', - `Solucion` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `Localizacion` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `Estado` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Fecha_Simple` date DEFAULT NULL, - `Id_Comercial` int(11) DEFAULT '20', - `Risk` double NOT NULL DEFAULT '0', - `Rojo` bigint(21) DEFAULT '0', - `Naranja` bigint(21) DEFAULT '0', - `Amarillo` bigint(21) DEFAULT '0' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Ticket_Portes` --- - -DROP TABLE IF EXISTS `Ticket_Portes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Ticket_Portes` ( - `Id_Ticket` int(11) NOT NULL, - `rate` tinyint(4) NOT NULL COMMENT 'Tarifa', - `real_amount` double NOT NULL COMMENT 'Cantidad pactada con la agencia', - `payed_amount` double NOT NULL COMMENT 'Cantidad reflejada en el Ticket', - PRIMARY KEY (`Id_Ticket`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `VelocityKK` --- - -DROP TABLE IF EXISTS `VelocityKK`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `VelocityKK` ( - `tipo_id` int(11) NOT NULL, - `Fecha` datetime NOT NULL, - `Disponible` int(11) DEFAULT NULL, - `Visible` int(11) DEFAULT NULL, - `velocity_id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`velocity_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `XDiario_ALL` --- - -DROP TABLE IF EXISTS `XDiario_ALL`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `XDiario_ALL` ( - `empresa_id` int(5) NOT NULL, - `SUBCTA` varchar(11) COLLATE utf8_unicode_ci NOT NULL, - `Eurodebe` double DEFAULT NULL, - `Eurohaber` double DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `FECHA_EX` date DEFAULT NULL, - KEY `Cuenta` (`SUBCTA`), - KEY `empresa` (`empresa_id`), - KEY `Fecha` (`Fecha`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_grafico_simple` --- - -DROP TABLE IF EXISTS `analisis_grafico_simple`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_grafico_simple` ( - `Año` smallint(5) unsigned NOT NULL, - `Semana` tinyint(3) unsigned NOT NULL, - `Importe` double DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `analisis_grafico_ventas` --- - -DROP TABLE IF EXISTS `analisis_grafico_ventas`; -/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `analisis_grafico_ventas` AS SELECT - 1 AS `Año`, - 1 AS `Semana`, - 1 AS `Importe`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `analisis_ventas` --- - -DROP TABLE IF EXISTS `analisis_ventas`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas` ( - `Familia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `Reino` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `Comercial` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `Provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `Año` smallint(5) unsigned NOT NULL, - `Mes` tinyint(3) unsigned NOT NULL, - `Semana` tinyint(3) unsigned NOT NULL, - `Vista` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `Importe` double NOT NULL, - KEY `Año` (`Año`,`Semana`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_almacen_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_almacen_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_almacen_evolution` ( - `Semana` int(11) NOT NULL, - `Almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `Ventas` int(11) NOT NULL, - `Año` int(11) NOT NULL, - `Periodo` int(11) NOT NULL, - KEY `Almacen` (`Almacen`,`Periodo`), - KEY `Periodo` (`Periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_comprador_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_comprador_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_comprador_evolution` ( - `semana` int(11) NOT NULL, - `comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `comprador` (`comprador`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_familia_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_familia_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_familia_evolution` ( - `semana` int(11) NOT NULL, - `familia` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - KEY `familia` (`familia`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_provincia_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_provincia_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_provincia_evolution` ( - `semana` int(11) NOT NULL, - `provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `provincia` (`provincia`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_reino_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_reino_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_reino_evolution` ( - `semana` int(11) NOT NULL, - `reino` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `reino` (`reino`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `analisis_ventas_simple` --- - -DROP TABLE IF EXISTS `analisis_ventas_simple`; -/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `analisis_ventas_simple` AS SELECT - 1 AS `Año`, - 1 AS `Semana`, - 1 AS `Importe`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `analisis_ventas_vendedor_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_vendedor_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_vendedor_evolution` ( - `semana` int(11) NOT NULL, - `vendedor` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `vendedor` (`vendedor`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `analisis_ventas_vista_evolution` --- - -DROP TABLE IF EXISTS `analisis_ventas_vista_evolution`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `analisis_ventas_vista_evolution` ( - `semana` int(11) NOT NULL, - `vista` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `ventas` int(11) NOT NULL, - `año` int(11) NOT NULL, - `periodo` int(11) NOT NULL, - UNIQUE KEY `vista` (`vista`,`periodo`), - KEY `periodo` (`periodo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calidad_detalle` --- - -DROP TABLE IF EXISTS `calidad_detalle`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calidad_detalle` ( - `Id_Cliente` int(11) NOT NULL, - `calidad_parametros_id` int(2) NOT NULL, - `valor` int(3) DEFAULT NULL, - PRIMARY KEY (`Id_Cliente`,`calidad_parametros_id`), - KEY `calidad_parametros_detalle_idx` (`calidad_parametros_id`), - CONSTRAINT `calidad_parametros_detalle` FOREIGN KEY (`calidad_parametros_id`) REFERENCES `calidad_parametros` (`calidad_parametros_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `calidad_parametros` --- - -DROP TABLE IF EXISTS `calidad_parametros`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `calidad_parametros` ( - `calidad_parametros_id` int(2) NOT NULL, - `descripcion` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`calidad_parametros_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `claims_ratio` --- - -DROP TABLE IF EXISTS `claims_ratio`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `claims_ratio` ( - `Id_Cliente` int(11) NOT NULL DEFAULT '0', - `Consumo` decimal(10,2) DEFAULT NULL, - `Reclamaciones` decimal(10,2) DEFAULT NULL, - `Ratio` decimal(5,2) DEFAULT NULL, - `recobro` decimal(5,2) DEFAULT NULL, - `inflacion` decimal(5,2) NOT NULL DEFAULT '1.00', - PRIMARY KEY (`Id_Cliente`), - CONSTRAINT `claims_ratio_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `comparativa_clientes` --- - -DROP TABLE IF EXISTS `comparativa_clientes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `comparativa_clientes` ( - `Fecha` date NOT NULL DEFAULT '0000-00-00', - `Id_Cliente` int(11) NOT NULL DEFAULT '0', - `Propietario` int(11) DEFAULT NULL, - `titular` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `suplente` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `trabajador` int(11) DEFAULT NULL, - `actual` double DEFAULT NULL, - `pasado` double DEFAULT NULL, - `concepto` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '', - KEY `cc_data_indez` (`Fecha`), - KEY `cc_Id_Cliente_index` (`Id_Cliente`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `customerDebtInventory` --- - -DROP TABLE IF EXISTS `customerDebtInventory`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `customerDebtInventory` ( - `Id_Cliente` int(11) NOT NULL, - `Debt` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'CREATE TABLE bi.customerDebtInventory\n\nSELECT Id_Cliente, sum(Euros) as Debt\n\nFROM \n(\nSELECT Id_Cliente, Entregado as Euros\n\nFROM Recibos \n\nWHERE Fechacobro < ''2017-01-01\n''\nUNION ALL\n\nSELECT Id_Cliente, - Importe \nFROM Facturas\nWHERE Fecha < ''2017-01-01''\n) sub \nGROUP BY Id_Cliente', - PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `customerRiskOverdue` --- - -DROP TABLE IF EXISTS `customerRiskOverdue`; -/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `customerRiskOverdue` AS SELECT - 1 AS `customer_id`, - 1 AS `amount`, - 1 AS `company_id`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `customer_risk` --- - -DROP TABLE IF EXISTS `customer_risk`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `customer_risk` ( - `customer_id` int(11) NOT NULL DEFAULT '0', - `company_id` smallint(6) unsigned NOT NULL DEFAULT '0', - `amount` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`customer_id`,`company_id`), - KEY `company_id` (`company_id`), - CONSTRAINT `customer_risk_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `customer_risk_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `vn2008`.`empresa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `daily_task_log` --- - -DROP TABLE IF EXISTS `daily_task_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `daily_task_log` ( - `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `defaulters` --- - -DROP TABLE IF EXISTS `defaulters`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `defaulters` ( - `client` int(11) NOT NULL, - `date` date NOT NULL, - `amount` double NOT NULL DEFAULT '0', - `defaulterSince` date DEFAULT NULL, - `hasChanged` tinyint(1) DEFAULT NULL, - PRIMARY KEY (`client`,`date`), - KEY `client` (`client`), - KEY `date` (`date`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `defaulting` --- - -DROP TABLE IF EXISTS `defaulting`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `defaulting` ( - `date` date NOT NULL, - `amount` double NOT NULL, - PRIMARY KEY (`date`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `f_tvc` --- - -DROP TABLE IF EXISTS `f_tvc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `f_tvc` ( - `Id_Ticket` int(11) NOT NULL, - PRIMARY KEY (`Id_Ticket`), - CONSTRAINT `id_ticket_to_comisionantes` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacenamos la lista de tickets para agilizar la consulta. Corresponde a los clientes REAL y en los almacenes COMISIONANTES'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `facturacion_media_anual` --- - -DROP TABLE IF EXISTS `facturacion_media_anual`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `facturacion_media_anual` ( - `Id_Cliente` int(11) NOT NULL, - `Consumo` double(17,0) DEFAULT NULL, - PRIMARY KEY (`Id_Cliente`), - CONSTRAINT `fmaId_Cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `last_Id_Cubo` --- - -DROP TABLE IF EXISTS `last_Id_Cubo`; -/*!50001 DROP VIEW IF EXISTS `last_Id_Cubo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `last_Id_Cubo` AS SELECT - 1 AS `Id_Compra`, - 1 AS `Id_Article`, - 1 AS `warehouse_id`, - 1 AS `Id_Cubo`, - 1 AS `Packing`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `lastaction` --- - -DROP TABLE IF EXISTS `lastaction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `lastaction` ( - `Id_Cliente` int(11) unsigned NOT NULL, - `Cliente` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `Ultima_accion` date DEFAULT NULL, - `Comercial` varchar(3) CHARACTER SET utf8 DEFAULT NULL, - PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `live_counter` --- - -DROP TABLE IF EXISTS `live_counter`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `live_counter` ( - `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `amount` double NOT NULL, - PRIMARY KEY (`odbc_date`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mana_inventory_kk` --- - -DROP TABLE IF EXISTS `mana_inventory_kk`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mana_inventory_kk` ( - `Id_Trabajador` int(11) NOT NULL, - `mana` double NOT NULL DEFAULT '0', - `dated` date NOT NULL, - PRIMARY KEY (`Id_Trabajador`,`dated`), - CONSTRAINT `fk_trabajador_mana_inventory` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `movimientos_log` --- - -DROP TABLE IF EXISTS `movimientos_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `movimientos_log` ( - `idmovimientos_log` int(11) NOT NULL AUTO_INCREMENT, - `Id_Movimiento` int(11) NOT NULL, - `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `Id_Trabajador` int(11) NOT NULL, - `field_name` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, - `new_value` double DEFAULT NULL, - PRIMARY KEY (`idmovimientos_log`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `partitioning_information` --- - -DROP TABLE IF EXISTS `partitioning_information`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `partitioning_information` ( - `schema_name` varchar(10) CHARACTER SET utf8 NOT NULL, - `table_name` varchar(20) CHARACTER SET utf8 NOT NULL, - `date_field` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `table_depending` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `execution_order` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`schema_name`,`table_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `primer_pedido` --- - -DROP TABLE IF EXISTS `primer_pedido`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `primer_pedido` ( - `Id_Cliente` int(11) NOT NULL, - `Id_Ticket` int(11) NOT NULL, - `month` tinyint(1) NOT NULL, - `year` smallint(2) NOT NULL, - `total` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rotacion` --- - -DROP TABLE IF EXISTS `rotacion`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rotacion` ( - `Id_Article` int(11) NOT NULL, - `warehouse_id` smallint(6) unsigned NOT NULL, - `total` int(10) NOT NULL DEFAULT '0', - `rotacion` decimal(10,4) NOT NULL DEFAULT '0.0000', - `cm3` int(11) NOT NULL DEFAULT '0', - `almacenaje` decimal(10,4) NOT NULL DEFAULT '0.0000', - `manipulacion` decimal(10,4) NOT NULL DEFAULT '0.0000', - `auxiliar` decimal(10,4) NOT NULL DEFAULT '0.0000', - `mermas` decimal(10,4) NOT NULL DEFAULT '0.0000', - PRIMARY KEY (`Id_Article`,`warehouse_id`), - KEY `id_article_rotacion_idx` (`Id_Article`), - KEY `warehouse_id_rotacion_idx` (`warehouse_id`), - CONSTRAINT `id_article_rotaci` FOREIGN KEY (`Id_Article`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `warehouse_id_rotaci` FOREIGN KEY (`warehouse_id`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de rotacion en los ultimos 365 dias'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saldos_bancos` --- - -DROP TABLE IF EXISTS `saldos_bancos`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saldos_bancos` ( - `Semana` int(2) NOT NULL, - `Mes` int(2) NOT NULL, - `Año` int(4) NOT NULL, - `Entrada` double DEFAULT NULL, - `Salida` decimal(32,2) DEFAULT NULL, - `Saldo` double DEFAULT NULL, - `Id_Banco` int(11) NOT NULL DEFAULT '0', - `empresa_id` int(5) unsigned NOT NULL DEFAULT '0', - `Empresa` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saldos_bancos_pordia` --- - -DROP TABLE IF EXISTS `saldos_bancos_pordia`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saldos_bancos_pordia` ( - `Fecha` date NOT NULL, - `Entrada` double DEFAULT NULL, - `Salida` decimal(32,2) DEFAULT NULL, - `Saldo` double DEFAULT NULL, - `Id_Banco` int(11) NOT NULL DEFAULT '0', - `empresa_id` int(5) unsigned NOT NULL DEFAULT '0', - `Empresa` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', - `Año` int(4) NOT NULL, - `Mes` int(2) NOT NULL, - `Dia` int(2) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sales` --- - -DROP TABLE IF EXISTS `sales`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sales` ( - `Id_Trabajador` int(10) unsigned NOT NULL, - `year` int(10) unsigned NOT NULL, - `month` int(10) unsigned NOT NULL, - `weight` int(11) NOT NULL DEFAULT '0', - `boss_aid` int(10) NOT NULL DEFAULT '0', - `boss_id` int(10) NOT NULL DEFAULT '0', - `comision` int(11) DEFAULT NULL, - PRIMARY KEY (`Id_Trabajador`,`year`,`month`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `tarifa_componentes` --- - -DROP TABLE IF EXISTS `tarifa_componentes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_componentes` ( - `Id_Componente` int(11) NOT NULL AUTO_INCREMENT, - `Componente` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `tarifa_componentes_series_id` int(11) NOT NULL, - `tarifa_class` smallint(6) DEFAULT NULL, - `tax` double DEFAULT NULL, - `is_renewable` tinyint(2) NOT NULL DEFAULT '1', - PRIMARY KEY (`Id_Componente`), - KEY `series_componentes_idx` (`tarifa_componentes_series_id`), - KEY `comp` (`tarifa_class`), - CONSTRAINT `serie_componente` FOREIGN KEY (`tarifa_componentes_series_id`) REFERENCES `tarifa_componentes_series` (`tarifa_componentes_series_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `tarifa_componentes_series` --- - -DROP TABLE IF EXISTS `tarifa_componentes_series`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_componentes_series` ( - `tarifa_componentes_series_id` int(11) NOT NULL AUTO_INCREMENT, - `Serie` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `base` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', - `margen` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`tarifa_componentes_series_id`), - UNIQUE KEY `Serie_UNIQUE` (`Serie`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `tarifa_premisas` --- - -DROP TABLE IF EXISTS `tarifa_premisas`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_premisas` ( - `Id_Premisa` int(11) NOT NULL AUTO_INCREMENT, - `premisa` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`Id_Premisa`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `tarifa_warehouse` --- - -DROP TABLE IF EXISTS `tarifa_warehouse`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tarifa_warehouse` ( - `Id_Tarifa_Warehouse` int(11) NOT NULL AUTO_INCREMENT, - `warehouse_id` int(11) NOT NULL, - `Id_Premisa` int(11) NOT NULL, - `Valor` double NOT NULL, - PRIMARY KEY (`Id_Tarifa_Warehouse`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de gasto por almacen'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `v_clientes_jerarquia` --- - -DROP TABLE IF EXISTS `v_clientes_jerarquia`; -/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_clientes_jerarquia` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `Cliente`, - 1 AS `Comercial`, - 1 AS `Jefe`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `v_ventas_contables` --- - -DROP TABLE IF EXISTS `v_ventas_contables`; -/*!50001 DROP VIEW IF EXISTS `v_ventas_contables`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ventas_contables` AS SELECT - 1 AS `year`, - 1 AS `month`, - 1 AS `importe`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `variablesKK` --- - -DROP TABLE IF EXISTS `variablesKK`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `variablesKK` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `variable` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `value` double DEFAULT NULL, - `date` datetime DEFAULT NULL, - `text` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping routines for database 'bi' --- -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `nz`(dblCANTIDAD DOUBLE) RETURNS double -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 DROP PROCEDURE IF EXISTS `analisis_ventas_evolution_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_evolution_add`() -BEGIN - DECLARE vPreviousPeriod INT; - DECLARE vCurrentPeriod INT; - DECLARE vLastPeriod INT; - DECLARE vMinPeriod INT DEFAULT 201400; - DECLARE vMaxPeriod INT DEFAULT vn2008.vnperiod(CURDATE()); - - DECLARE vYear INT; - DECLARE vWeek INT; - - -- Almacen - - SET vCurrentPeriod = IFNULL(vLastPeriod, vMinPeriod); - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(Periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_almacen_evolution - WHERE Periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_almacen_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_almacen_evolution(Almacen, Ventas, Semana,Año, Periodo) - SELECT Almacen, sum(Ventas) AS Ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT almacen, sum(Importe) AS Ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY almacen - UNION ALL - SELECT almacen, - sum(Importe) AS Ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY almacen - UNION ALL - SELECT Almacen, Ventas - FROM bi.analisis_ventas_almacen_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Almacen; - END WHILE; - - -- Reino - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_reino_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_reino_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_reino_evolution(reino, ventas, semana,año, periodo) - SELECT reino, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Reino, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Reino - UNION ALL - SELECT Reino, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Reino - UNION ALL - SELECT reino, ventas - FROM bi.analisis_ventas_reino_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY reino; - END WHILE; - - -- Familia - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_familia_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_familia_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_familia_evolution(familia, ventas, semana,año, periodo) - SELECT Familia, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Familia, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY familia - UNION ALL - SELECT Familia, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY familia - UNION ALL - SELECT familia, ventas - FROM bi.analisis_ventas_familia_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Familia; - END WHILE; - - -- Comprador - -- FIXME: Bucle infinito porque la tabla está vacía -/* - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT IFNULL(MAX(periodo),vMinPeriod) INTO vPreviousPeriod - FROM bi.analisis_ventas_comprador_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_comprador_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_comprador_evolution(comprador, ventas, semana,año, periodo) - SELECT Comprador, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Comprador, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Comprador - UNION ALL - SELECT Comprador, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Comprador - UNION ALL - SELECT comprador, IFNULL(ventas,0) - FROM bi.analisis_ventas_comprador_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Comprador; - END WHILE; -*/ - -- Provincia - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_provincia_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_provincia_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_provincia_evolution(provincia, ventas, semana,año, periodo) - SELECT Provincia, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Provincia, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Provincia - UNION ALL - SELECT Provincia, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Provincia - UNION ALL - SELECT provincia, ventas - FROM bi.analisis_ventas_provincia_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Provincia; - END WHILE; - - -- Vista - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_vista_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_vista_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_vista_evolution(vista, ventas, semana,año, periodo) - SELECT vista, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Vista, sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Vista - UNION ALL - SELECT Vista, - sum(Importe) AS ventas - FROM bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Vista - UNION ALL - SELECT vista, ventas - FROM bi.analisis_ventas_vista_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY Vista; - END WHILE; - - -- Vendedor - - SET vCurrentPeriod = vMinPeriod; - - WHILE vCurrentPeriod < vMaxPeriod - DO - SELECT MAX(periodo) INTO vPreviousPeriod - FROM bi.analisis_ventas_vendedor_evolution - WHERE periodo < vMaxPeriod; - - SELECT MIN(period) INTO vCurrentPeriod - FROM vn2008.time - WHERE period > vPreviousPeriod; - - SET vYear = FLOOR(vCurrentPeriod / 100); - SET vWeek = vCurrentPeriod - (vYear * 100); - - DELETE FROM bi.analisis_ventas_vendedor_evolution - WHERE Periodo = vCurrentPeriod; - - REPLACE bi.analisis_ventas_vendedor_evolution(vendedor, ventas, semana,año, periodo) - SELECT Comercial AS vendedor, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod - FROM ( - SELECT Comercial, sum(Importe) AS ventas - from bi.analisis_ventas - WHERE vYear = Año - AND vWeek = Semana - GROUP BY Comercial - UNION ALL - SELECT Comercial, - sum(Importe) AS ventas - from bi.analisis_ventas - WHERE vYear - 1 = Año - AND vWeek = Semana - GROUP BY Comercial - UNION ALL - SELECT vendedor, ventas - FROM bi.analisis_ventas_vendedor_evolution - WHERE Periodo = vPreviousPeriod - ) sub - GROUP BY vendedor; - END WHILE; -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 DROP PROCEDURE IF EXISTS `analisis_ventas_simple` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_simple`() -BEGIN - -TRUNCATE bi.analisis_grafico_simple; - -INSERT INTO bi.analisis_grafico_simple SELECT * FROM bi.analisis_grafico_ventas; - -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 DROP PROCEDURE IF EXISTS `analisis_ventas_update` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_update`() -BEGIN - - DECLARE vLastMonth DATE; - - SET vLastMonth = util.firstDayOfMonth(TIMESTAMPADD(MONTH, -1, CURDATE())); - - DELETE FROM bi.analisis_ventas - WHERE Año > YEAR(vLastMonth) - OR (Año = YEAR(vLastMonth) AND Mes >= MONTH(vLastMonth)); - - INSERT INTO bi.analisis_ventas - - SELECT - `tp`.`Tipo` AS `Familia`, - `r`.`reino` AS `Reino`, - `tr`.`CodigoTrabajador` AS `Comercial`, - `tr2`.`CodigoTrabajador` AS `Comprador`, - `p`.`name` AS `Provincia`, - `w`.`name` AS `almacen`, - `time`.`year` AS `Año`, - `time`.`month` AS `Mes`, - `time`.`week` AS `Semana`, - `v`.`vista` AS `Vista`, - `bt`.`importe` AS `Importe` - FROM - (((((((((`bs`.`ventas` `bt` - LEFT JOIN `vn2008`.`Tipos` `tp` ON ((`tp`.`tipo_id` = `bt`.`tipo_id`))) - LEFT JOIN `vn2008`.`reinos` `r` ON ((`r`.`id` = `tp`.`reino_id`))) - LEFT JOIN `vn2008`.`Clientes` c on c.Id_Cliente = bt.Id_Cliente - LEFT JOIN `vn2008`.`Trabajadores` `tr` ON ((`tr`.`Id_Trabajador` = `c`.`Id_Trabajador`))) - LEFT JOIN `vn2008`.`Trabajadores` `tr2` ON ((`tr2`.`Id_Trabajador` = `tp`.`Id_Trabajador`))) - JOIN vn2008.time on time.date = bt.fecha - JOIN vn2008.Movimientos m on m.Id_Movimiento = bt.Id_Movimiento - LEFT JOIN `vn2008`.`Tickets` `t` ON ((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) - JOIN vn2008.Agencias a on a.Id_Agencia = t.Id_Agencia - LEFT JOIN `vn2008`.`Vistas` `v` ON ((`v`.`vista_id` = `a`.`Vista`))) - LEFT JOIN `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`))) - WHERE bt.fecha >= vLastMonth AND r.mercancia; - -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 DROP PROCEDURE IF EXISTS `call_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `call_add`() -BEGIN - -DECLARE datSTART DATETIME DEFAULT '2012-03-01'/*CURDATE()*/ ; --- control -INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.call_add'); - --- Seleccionamos la ultima fecha introducida -SELECT MAX(Fecha) INTO datSTART FROM `call`; - - --- Borramos todas las entradas del dia datSTART por si hubiese registros nuevos -DELETE FROM `call` WHERE Fecha = datSTART; - -INSERT INTO bi.`call`(CodTrabajadorCartera,CodTrabajadorTelefono,dur_in,dur_out,Fecha,`year`,`month`,`week`,`hour`,phone) -SELECT vn2008.Averiguar_ComercialCliente(pb.Id_Cliente,Fecha) CodTrabajadorCartera,ll.CodigoTrabajador, dur_in, - dur_out, ll.Fecha,YEAR(ll.Fecha) `year`, MONTH(ll.Fecha) `month`,WEEK(ll.Fecha,7) `week`, Hora,phone -FROM -( -SELECT Id_Trabajador,CodigoTrabajador, IFNULL(billsec,0) dur_in, 0 dur_out, 1 as Recibidas, NULL as Emitidas, calldate as Fecha, - hour(calldate) as Hora,src as phone -FROM vn2008.Trabajadores T -INNER JOIN vn2008.cdr C ON C.dstchannel LIKE CONCAT('%', T.extension, '%') -WHERE calldate >= datSTART AND LENGTH(C.src) >=9 AND disposition = 'ANSWERED' AND duration -UNION ALL -SELECT Id_Trabajador,CodigoTrabajador,0 dur_in, IFNULL(billsec,0) dur_out, NULL as Recibidas, 1 as Emitidas, date(calldate), hour(calldate),dst -FROM vn2008.Trabajadores T -INNER JOIN vn2008.cdr C ON C.src = T.extension -WHERE calldate >= datSTART AND LENGTH(C.dst) >=9 AND disposition = 'ANSWERED' AND duration -) ll -INNER JOIN vn2008.Permisos USING(Id_Trabajador) -LEFT JOIN vn2008.v_phonebook pb ON pb.Telefono = ll.phone -WHERE Id_Grupo = 6; - -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 DROP PROCEDURE IF EXISTS `claim_ratio_routine` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `claim_ratio_routine`() -BEGIN - -DECLARE vMonthToRefund INT DEFAULT 4; - --- control -INSERT INTO vn2008.daily_task_log(consulta) - VALUES('bi.claim_ratio_routine START'); - -/* -* PAK 2015-11-20 -* Se trata de añadir a la tabla Greuges todos los -* cargos que luego vamos a utilizar para calcular el recobro -*/ - --- descuentos comerciales COD 11 - -INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, Importe, Id_Ticket) - SELECT Fecha, Id_Cliente, Concat('COD11 : ',Concepte), - round(Cantidad * - Preu * (100 - Descuento) / 100 ,2) AS Importe, t.Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket - WHERE Id_Article = 11 - AND Concepte NOT LIKE '$%' - AND Fecha > '2014-01-01' - HAVING nz(Importe) <> 0; - -DELETE mc.* - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE m.Id_Article = 11 - AND m.Concepte NOT LIKE '$%' - AND t.Fecha > '2017-01-01'; - -INSERT INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) - SELECT m.Id_Movimiento, 34, round(m.Preu * (100 - m.Descuento)/100,4) - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - WHERE m.Id_Article = 11 - AND m.Concepte NOT LIKE '$%' - AND t.Fecha > '2017-01-01'; - -UPDATE vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - SET Concepte = CONCAT('$ ',Concepte) - WHERE Id_Article = 11 - AND Concepte NOT LIKE '$%' - AND Fecha > '2014-01-01'; - --- Reclamaciones demasiado sensibles - -INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe, Greuges_type_id,Id_Ticket) - SELECT cm.Fecha - , cm.Id_Cliente - , concat('Claim ',cm.id,' : ', m.Concepte) - ,round( -1 * ((sensib -1)/4) * Cantidad * - Preu * (100 - Descuento) / 100, 2) AS Reclamaciones - , 4 - , m.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca USING(Id_Movimiento) - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3; - - -- Reclamaciones que pasan a Maná - -INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe , Greuges_type_id,Id_Ticket) - SELECT cm.Fecha - , cm.Id_Cliente - , concat('Claim_mana ',cm.id,' : ', m.Concepte) - ,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2) - AS Reclamaciones - ,3 - ,m.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca USING(Id_Movimiento) - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3 - AND cm.mana; - - -- Marcamos para no repetir -UPDATE vn2008.cl_act ca - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - SET greuge = 1 - WHERE ca.cl_sol_id NOT IN (1,5) - AND ca.greuge = 0 - AND cm.cl_est_id = 3; - - - --- Recobros - -DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; -CREATE TEMPORARY TABLE tmp.ticket_list -(PRIMARY KEY (Id_Ticket)) -SELECT DISTINCT t.Id_Ticket - FROM vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Tickets_state ts ON ts.Id_Ticket = t.Id_Ticket - JOIN vncontrol.inter i ON i.inter_id = ts.inter_id - JOIN vn2008.state s ON s.id = i.state_id - WHERE mc.Id_Componente = 17 - AND mc.greuge = 0 - AND t.Fecha >= '2016-10-01' - AND t.Fecha < CURDATE() - AND t.warehouse_id <> 41 - 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; - -INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, - Greuges_type_id, Id_Ticket) - SELECT Id_Cliente - ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) - AS dif - ,date(t.Fecha) - , 2 - ,tt.Id_Ticket - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket - JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc - ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17 - GROUP BY t.Id_Ticket - HAVING ABS(dif) > 1; - -UPDATE vn2008.Movimientos_componentes mc - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket - SET greuge = 1 - WHERE Id_Componente = 17; - -/* -* Recalculamos la ratio de las reclamaciones, que luego -* se va a utilizar en el recobro -*/ - -DELETE FROM bi.claims_ratio; - -REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) - SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones, - round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0 - FROM bi.facturacion_media_anual fm - LEFT JOIN( - SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) * - Cantidad * Preu * (100 - Descuento) / 100)) - AS Reclamaciones - FROM vn2008.Movimientos m - JOIN vn2008.cl_act ca - ON ca.Id_Movimiento = m.Id_Movimiento - JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id - WHERE ca.cl_sol_id NOT IN (1,5) - AND cm.cl_est_id = 3 - AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, CURDATE()) - GROUP BY cm.Id_Cliente - ) claims ON claims.Id_Cliente = fm.Id_Cliente; - - --- 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 <= CURDATE() - GROUP BY Id_Cliente - ) g ON g.Id_Cliente = cr.Id_Cliente - SET recobro = GREATEST(0,round(nz(Greuge) / - (nz(Consumo) * vMonthToRefund / 12 ) ,3)); - --- control -INSERT INTO vn2008.daily_task_log(consulta) - VALUES('bi.claim_ratio_routine END'); -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 DROP PROCEDURE IF EXISTS `clean` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN -DECLARE vDateShort DATETIME; -DECLARE vDateLong DATETIME; - -SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); -SET vDateLong = TIMESTAMPADD(MONTH, -18,CURDATE()); - -INSERT INTO bi.daily_task_log(state) VALUES('clean START'); - -DELETE FROM bi.comparativa_clientes WHERE Fecha < vDateLong; -DELETE FROM bi.Greuge_Evolution WHERE Fecha < vDateShort AND weekday(Fecha) != 1; - -INSERT INTO bi.daily_task_log(state) VALUES('clean END'); -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 DROP PROCEDURE IF EXISTS `clean_launcher` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clean_launcher`() -BEGIN - - call vn2008.clean(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 DROP PROCEDURE IF EXISTS `comparativa_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add`() -BEGIN - DECLARE lastCOMP INT; # Se trata de una variable para almacenar el ultimo valor del Periodo - - SELECT MAX(Periodo) INTO lastCOMP FROM vn2008.Comparativa; - -- Fijaremos las ventas con más de un mes de antiguedad en la tabla Comparativa - - IF lastCOMP < vn2008.vnperiod(CURDATE())- 3 AND vn2008.vnweek(CURDATE()) > 3 THEN - - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT vn2008.vnperiod(T.Fecha) AS Periodo - , Id_Article - , warehouse_id - , SUM(Cantidad) AS Total - , SUM(Cantidad * Preu * (100 - Descuento) / 100) precio - FROM vn2008.Movimientos M - JOIN vn2008.Tickets T USING (Id_Ticket) - JOIN vn2008.Articles A USING (Id_Article) - LEFT JOIN vn2008.Tipos ti ON ti.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = ti.reino_id - WHERE T.Fecha BETWEEN TIMESTAMPADD(DAY,-60,CURDATE()) AND TIMESTAMPADD(DAY,-30,CURDATE()) - AND T.Id_Cliente NOT IN(400,200) - AND display <> 0 AND warehouse_id NOT IN (0,13) - GROUP BY Id_Article, Periodo, warehouse_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 DROP PROCEDURE IF EXISTS `comparativa_add_manual` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add_manual`(IN dat_START DATE, IN dat_END DATE) -BEGIN - - DECLARE datINI DATETIME; - DECLARE datFIN DATETIME; - - -- Seleccionamos la fecha minima/maxima del periodo que vamos a consultar - SELECT MIN(`date`) INTO datINI FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_START); - SELECT TIMESTAMP(MAX(`date`),'23:59:59') INTO datFIN FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_END); - - DELETE FROM vn2008.Comparativa WHERE Periodo BETWEEN vn2008.vnperiod(dat_START) and vn2008.vnperiod(dat_END); - - REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) - SELECT tm.period AS Periodo - , M.Id_Article - , t.warehouse_id - , SUM(Cantidad) AS Total - , sum(v.importe) AS precio - FROM vn2008.Movimientos M - JOIN vn2008.Tickets t on t.Id_Ticket = M.Id_Ticket - JOIN bs.ventas v on v.Id_Movimiento = M.Id_Movimiento - JOIN vn2008.time tm on tm.date = v.fecha - JOIN vn2008.Tipos tp on v.tipo_id = tp.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - WHERE v.fecha BETWEEN datINI and datFIN - AND r.display <> 0 AND t.warehouse_id NOT IN (0,13) - GROUP BY Id_Article, Periodo, t.warehouse_id; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `customer_risk_update` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2)) -BEGIN - IF v_amount IS NOT NULL - THEN - INSERT INTO bi.customer_risk - SET - customer_id = v_customer, - company_id = v_company, - amount = v_amount - ON DUPLICATE KEY UPDATE - amount = amount + VALUES(amount); +-- OBSOLETO USAR vn.refund() + DECLARE idC MEDIUMINT; + DECLARE newFEC DATE; + DECLARE idWH TINYINT; + DECLARE idUSER SMALLINT; + DECLARE idEMP MEDIUMINT; + DECLARE idCON MEDIUMINT; + DECLARE newTICKET MEDIUMINT; + + + SELECT Id_Cliente, TIMESTAMPADD(DAY, 1,Fecha), warehouse_id, empresa_id, Id_Consigna INTO idC, newFEC, idWH, idEMP, idCON + FROM Tickets WHERE Id_Ticket = idT; + + SELECT Id_Trabajador into idUSER from Trabajadores where user_id = account.userGetId(); + IF idUSER IS NULL THEN + SET idUSER = 20; 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 DROP PROCEDURE IF EXISTS `defaultersFromDate` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaultersFromDate`(IN vDate DATE) -BEGIN - -SELECT t1.*, c.Cliente, w.workerCode, c.pay_met_id,c.Vencimiento -FROM ( --- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy - select * from( - select today.client, today.amount todayAmount, yesterday.amount yesterdayAmount, round(yesterday.amount - today.amount,2) as difference, defaulterSince - from - (select client, amount, defaulterSince - from defaulters - where date = vDate and hasChanged) today - join - (select client, amount - from defaulters - where date = TIMESTAMPADD(DAY,-1,vDate)) yesterday using(client) - having today.amount > 0 and difference <> 0 - ) newDefaulters -)t1 left join vn2008.Clientes c ON t1.client = c.Id_Cliente - left join vn.worker w ON w.id = c.Id_Trabajador; + CALL ticket_new_complet(idC, newFEC, idWH, idUSER, idEMP, idCON, 23,NULL,newTICKET); + + UPDATE Tickets SET Etiquetasemitidas = 1 WHERE Id_Ticket = newTICKET; + + INSERT INTO Movimientos(Id_Ticket, Id_Article, Cantidad, Concepte, Preu, Descuento, PrecioFijado) + SELECT newTICKET, Id_Article, -1 * Cantidad, Concepte, Preu, Descuento, 1 FROM Movimientos WHERE Id_Ticket = idT; + SELECT newTICKET; + 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 DROP PROCEDURE IF EXISTS `defaulting` */; +/*!50003 DROP PROCEDURE IF EXISTS `__proveedores_extracto` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -43365,1318 +43150,90 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaulting`(IN vDate DATE) -BEGIN - DECLARE vDone BOOLEAN; - DECLARE vClient INT; - DECLARE vAmount INT; - DECLARE vDateInvoice DATE; - DECLARE vAmountInvoice DECIMAL(10,2); - DECLARE vDueDay INT; - DECLARE vGraceDays INT; - DECLARE defaulters CURSOR FOR - SELECT client, amount, Vencimiento, graceDays FROM bi.defaulters d - JOIN vn2008.Clientes c ON c.Id_Cliente = d.client - JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id - WHERE hasChanged AND date = vDate; - - DECLARE invoices CURSOR FOR - SELECT Fecha, importe FROM vn2008.Facturas f - WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - -- Control - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); - - DELETE FROM bi.defaulters WHERE date = vDate; - - INSERT INTO bi.defaulters(client, date, amount) - SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount - FROM bi.customerRiskOverdue - GROUP BY customer_id; - - -- marcamos si ha cambiado y heredamos la fecha defaulterSince - UPDATE bi.defaulters d - JOIN ( - SELECT * FROM( - SELECT client, amount , defaulterSince FROM bi.defaulters - WHERE date <= TIMESTAMPADD(DAY,-1, vDate) - ORDER BY date DESC) t GROUP BY client - ) yesterday using(client) - SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), - d.defaulterSince = yesterday.defaulterSince - WHERE d.date = vDate ; - - OPEN defaulters; - defaulters: LOOP - SET vDone = FALSE; - SET vAmount = 0; - FETCH defaulters INTO vClient,vAmount, vDueDay, vGraceDays; - IF vDone THEN - LEAVE defaulters; - END IF; - OPEN invoices; - invoices:LOOP - - FETCH invoices INTO vDateInvoice, vAmountInvoice; - IF vDone THEN - LEAVE invoices; - END IF; - - IF TIMESTAMPADD(DAY, vGraceDays, vn2008.paymentday(vDateInvoice, vDueDay)) <= vDate THEN - SET vAmount = vAmount - vAmountInvoice; - IF vAmount <= 0 THEN - UPDATE defaulters SET defaulterSince = vn2008.paymentday(vDateInvoice, vDueDay) - WHERE client = vClient and date = vDate; - - SET vAmount = 0; - LEAVE invoices; - END IF; - END IF; - END LOOP; - CLOSE invoices; - END LOOP; - CLOSE defaulters; - DELETE FROM bi.defaulting WHERE date = vDate; - - INSERT INTO bi.defaulting(date, amount) - SELECT vDate, SUM(amount) - FROM bi.defaulters - WHERE date = vDate and amount > 0; - - CALL vn.clientFreeze(); -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 DROP PROCEDURE IF EXISTS `defaultingkk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaultingkk`(IN vDate DATE) -BEGIN - DECLARE done BIT DEFAULT 0; - DECLARE vClient INT; - DECLARE vAmount INT; - DECLARE vDateInvoice DATE; - DECLARE vAmountInvoice DECIMAL(10,2); - DECLARE vDueDay INT; - DECLARE vGraceDays INT; - DECLARE defaulters CURSOR FOR - SELECT client, amount, Vencimiento, graceDays FROM bi.defaulters d - JOIN vn2008.Clientes c ON c.Id_Cliente = d.client - JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id - WHERE hasChanged AND date = vDate; - - DECLARE invoices CURSOR FOR - SELECT Fecha, importe FROM vn2008.Facturas f - WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - -- Control - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); - - DELETE FROM bi.defaulters WHERE date = vDate; - - INSERT INTO bi.defaulters(client, date, amount) - SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount - FROM bi.customerRiskOverdue - GROUP BY customer_id; - - -- marcamos si ha cambiado y heredamos la fecha defaulterSince - UPDATE bi.defaulters d - JOIN ( - SELECT client, amount , defaulterSince FROM bi.defaulters - WHERE date = TIMESTAMPADD(DAY,-1, vDate) - GROUP BY client - ) yesterday using(client) - SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), - d.defaulterSince = yesterday.defaulterSince - WHERE d.date = vDate ; - - OPEN defaulters; - defaulters: BEGIN - REPEAT - FETCH defaulters INTO vClient,vAmount, vDueDay, vGraceDays; - OPEN invoices; - invoices:BEGIN - REPEAT - - FETCH invoices INTO vDateInvoice, vAmountInvoice; - IF TIMESTAMPADD(DAY, vGraceDays, vn2008.paymentday(vDateInvoice, vDueDay)) <= vDate THEN - SET vAmount = vAmount - vAmountInvoice; - IF vAmount < 0 THEN - UPDATE defaulters SET defaulterSince = vn2008.paymentday(vDateInvoice, vDueDay) - WHERE client = vClient and date = vDate; - SET vAmount = 0; - LEAVE invoices; - END IF; - END IF; - UNTIL done END REPEAT; - END invoices; - CLOSE invoices; - UNTIL done OR vClient IS NULL END REPEAT; - END defaulters; - CLOSE defaulters; - DELETE FROM bi.defaulting WHERE date = vDate; - - INSERT INTO bi.defaulting(date, amount) - SELECT vDate, SUM(amount) - FROM bi.defaulters - WHERE date = vDate and amount > 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 DROP PROCEDURE IF EXISTS `defaulting_launcher` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `defaulting_launcher`() +CREATE DEFINER=`root`@`%` PROCEDURE `__proveedores_extracto`(IN idPROV INT, IN idMONEDA INT, IN idEMP INT) BEGIN - CALL bi.defaulting(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 DROP PROCEDURE IF EXISTS `equaliza` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `equaliza`(IN wh_id INT) -BEGIN +SET @saldo_eur:= 0; +SET @saldo_div:= 0; -DECLARE datEQ DATETIME; -/* JGF 2017-03-20 cuelga el sistema - -SELECT `date` INTO datEQ FROM bi.variables WHERE variable = IF(wh_id = 17,'eq_mcf','equalizator'); - - -IF TIMEDIFF(now(), datEQ) > '00:05:00' THEN - - UPDATE bi.Equalizator e - JOIN - ( - SELECT - Vista, - sum(1) as pedido, - sum(PedidoImpreso) as impreso, - sum(t.Factura IS NOT NULL - OR t.Etiquetasemitidas - OR nz(ticket_id) <> 0) as encajado - FROM - vn2008.Movimientos - JOIN - vn2008.Tickets t USING (Id_Ticket) - JOIN - vn2008.Agencias a ON t.Id_Agencia = a.Id_Agencia - JOIN - vn2008.Clientes C USING (Id_Cliente) - LEFT JOIN - (SELECT distinct - ticket_id - FROM - vn2008.expeditions e JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id WHERE Fecha >= curDate()) exp ON ticket_id = Id_Ticket - WHERE - invoice And Fecha >= curDate() - AND t.warehouse_id = wh_id - AND fecha < (TIMESTAMPADD(DAY, 1, CURDATE())) - GROUP BY Vista) sub using(Vista) - SET e.Pedido = sub.pedido, e.Impreso = sub.impreso, e.Encajado = sub.encajado; - - UPDATE bi.variables SET `date`= now() WHERE variable = IF(wh_id = 17,'eq_mcf','equalizator'); - - -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 DROP PROCEDURE IF EXISTS `facturacion_media_anual_update` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `facturacion_media_anual_update`() -BEGIN - --- control -INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.facturacion_media_anual_update'); - -TRUNCATE TABLE bi.facturacion_media_anual; - -REPLACE bi.facturacion_media_anual(Id_Cliente, Consumo) -select Id_Cliente, avg(Consumo) -from ( - Select Id_Cliente, YEAR(fecha) year, MONTH(fecha) month, sum(importe) as Consumo - from bs.ventas - where fecha >= TIMESTAMPADD(YEAR,-1,CURDATE()) - group by Id_Cliente, year, month -) vol -group by Id_Cliente; - -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 DROP PROCEDURE IF EXISTS `greuge_dif_porte_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `greuge_dif_porte_add`() -BEGIN - -DECLARE datSTART DATETIME DEFAULT TIMESTAMPADD(DAY,-10,CURDATE()); -DECLARE datEND DATETIME DEFAULT TIMESTAMPADD(DAY,-1,CURDATE()); - -DROP TEMPORARY TABLE IF EXISTS tmp.dp; - -CREATE TEMPORARY TABLE tmp.dp - (PRIMARY KEY (Id_Ticket)) - SELECT - t.Id_Ticket, - SUM(az.price * IF( - e.EsBulto = 71 - AND ISNULL(e.Id_Article) - AND a.Vista = 2, - 0.75, - 1 - ) - ) AS teorico, - 00000.00 as practico, - 00000.00 as greuge +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 - vn2008.Tickets t - JOIN vn2008.Clientes cli ON cli.Id_cliente = t.Id_Cliente - LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.Id_Ticket - JOIN vn2008.Consignatarios c ON c.Id_Consigna = t.Id_Consigna - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn2008.Agencias_province ap ON t.warehouse_id = ap.warehouse_id - AND ap.province_id = c.province_id - AND ap.agency_id = a.agency_id - JOIN vn2008.Agencias_zonas az ON az.Id_Agencia = t.Id_Agencia - AND az.zona = ap.zona - AND t.warehouse_id = az.warehouse_id - AND az.Id_Article = e.EsBulto + (SELECT + 'R', + NULL as banco_id, + r.empresa_id, + r.serie, + r.id, + r.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 + FROM + recibida r + JOIN recibida_vencimiento rv on rv.recibida_id = r.id + JOIN Monedas m on m.Id_Moneda = r.moneda_id WHERE - t.Fecha between datSTART AND datEND - AND cli.`real` - AND t.empresa_id IN (442 , 567) - GROUP BY t.Id_Ticket; - -DROP TEMPORARY TABLE IF EXISTS tmp.dp_aux; - -CREATE TEMPORARY TABLE tmp.dp_aux - (PRIMARY KEY (Id_Ticket)) - SELECT t.Id_Ticket, sum(freight) as porte - FROM tmp.dp - JOIN vn2008.Tickets t ON t.Id_Ticket = dp.Id_Ticket - JOIN vn2008.Rutas r on r.Id_Ruta = t.Id_Ruta - JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia - JOIN ( - SELECT - M.Id_Ticket, - M.Cantidad * (vn2008.CM3(b.Id_Compra) / 1000000 / C.Packing) * (az.price / 0.08) AS freight - FROM - vn2008.Movimientos M - JOIN vn2008.Tickets t ON t.Id_Ticket = M.Id_Ticket - JOIN vn2008.Consignatarios c ON c.Id_Consigna = t.Id_Consigna - JOIN bi.Last_buy_id b ON M.Id_Article = b.Id_Article - AND t.warehouse_id = b.warehouse_id - JOIN vn2008.Compres C ON b.Id_Compra = C.Id_Compra - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn2008.Agencias_province ap ON t.warehouse_id = ap.warehouse_id - AND ap.province_id = c.province_id - AND ap.agency_id = a.agency_id - JOIN vn2008.Agencias_zonas az ON az.Id_Agencia = t.Id_Agencia - AND az.zona = ap.zona - AND t.warehouse_id = az.warehouse_id - AND az.Id_Article = 71 - WHERE t.Fecha between datSTART AND datEND - ) vmv ON vmv.Id_Ticket = t.Id_Ticket - WHERE a.is_volumetric - GROUP BY t.Id_Ticket; - - UPDATE tmp.dp - JOIN tmp.dp_aux using(Id_Ticket) - SET teorico = porte; - -DROP TEMPORARY TABLE IF EXISTS tmp.dp_aux; - -CREATE TEMPORARY TABLE tmp.dp_aux - (PRIMARY KEY (Id_Ticket)) - SELECT dp.Id_Ticket, sum(Cantidad * Valor) as valor - FROM tmp.dp - JOIN vn2008.Movimientos m using(Id_Ticket) - JOIN vn2008.Movimientos_componentes mc using(Id_Movimiento) - WHERE Id_Componente = 15 - GROUP BY m.Id_Ticket; - -UPDATE tmp.dp - JOIN tmp.dp_aux using(Id_Ticket) - SET practico = valor; - -DROP TEMPORARY TABLE tmp.dp_aux; - -CREATE TEMPORARY TABLE tmp.dp_aux - (PRIMARY KEY (Id_Ticket)) - SELECT dp.Id_Ticket, Importe - FROM tmp.dp - JOIN - ( - SELECT Id_Ticket, sum(Importe) as Importe - FROM vn2008.Greuges g - WHERE Greuges_type_id = 1 - GROUP BY Id_Ticket - ) sub using(Id_Ticket); - -UPDATE tmp.dp - JOIN tmp.dp_aux using(Id_Ticket) - SET greuge = Importe; - - -INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) -SELECT t.Id_Cliente - , concat('dif_porte ', dp.Id_Ticket) - , round(teorico - practico - greuge,2) as Importe - , date(t.Fecha) - , 1 - ,t.Id_Ticket - FROM tmp.dp - JOIN vn2008.Tickets t on dp.Id_Ticket = t.Id_Ticket - WHERE ABS(teorico - practico - greuge) > 1; - - - -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 DROP PROCEDURE IF EXISTS `Greuge_Evolution_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Greuge_Evolution_Add`() -BEGIN - - /* - - Inserta en la tabla Greuge_Evolution el saldo acumulado de cada cliente, así como las ventas acumuladas en los ultimos 365 dias - , para poder controlar su evolucion - - */ - - - - DECLARE datFEC DATE; - DECLARE datFEC_TOMORROW DATE; - DECLARE datFEC_LASTYEAR DATE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - - GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; - SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')); - INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('jgallego@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); - INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('pako@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); - - END; - - SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('Greuge Evolution Add START'); - - SELECT TIMESTAMPADD(DAY,1,MAX(Fecha)),TIMESTAMPADD(DAY,2,MAX(Fecha)) INTO datFEC, datFEC_TOMORROW FROM bi.Greuge_Evolution; - - SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); - - DELETE FROM bi.Greuge_Evolution WHERE Fecha >= datFEC; - - DROP TEMPORARY TABLE IF EXISTS maxInvoice; - - 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 - HAVING maxFecha < timestampadd(month,-2,datFEC); - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('Greuge Evolution Add MIDDLE'); - - WHILE datFEC < CURDATE() DO - - REPLACE bi.Greuge_Evolution(Id_Cliente, Fecha, Greuge, Ventas) - - SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas - - FROM - - ( - SELECT Id_Cliente, sum(Importe) as Greuge - FROM vn2008.Greuges - where Fecha <= datFEC - group by Id_Cliente - - ) sub - - RIGHT JOIN - - ( - - SELECT Id_Cliente, sum(Ventas) as Ventas - FROM - ( - - SELECT Id_Cliente, IF (fecha != datFEC, -1,1) * (importe + recargo) as Ventas - FROM bs.ventas - WHERE fecha = datFEC or fecha = datFEC_LASTYEAR - - UNION ALL - - SELECT Id_Cliente, Ventas - FROM bi.Greuge_Evolution - WHERE Fecha = TIMESTAMPADD(DAY, -1, datFEC) - - ) sub - group by Id_Cliente - - ) v using(Id_Cliente) - ; - - - -- Ahora calcularemos el greuge muerto - - -- - UPDATE bi.Greuge_Evolution ge - JOIN maxInvoice using(Id_Cliente) - SET FOSIL = GREUGE - WHERE ge.Fecha = datFEC; - - - -- Recobro - - UPDATE bi.Greuge_Evolution ge - JOIN ( - SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket - JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento - WHERE t.Fecha >= datFEC - AND t.Fecha < datFEC_TOMORROW - AND mc.Id_Componente = 17 -- Recobro - GROUP BY cs.Id_Cliente - ) sub using(Id_Cliente) - SET Recobro = Importe - WHERE ge.Fecha = datFEC; - - INSERT INTO vn2008.daily_task_log(consulta) VALUES(CONCAT('Greuge Evolution ',datFEC)); - - SET datFEC = datFEC_TOMORROW; - SET datFEC_TOMORROW = TIMESTAMPADD(DAY,1,datFEC_TOMORROW); - SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); - - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS maxInvoice; - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('Greuge Evolution Add END'); - -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 DROP PROCEDURE IF EXISTS `last_buy_id_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `last_buy_id_add`() -BEGIN - --- control --- INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.last_buy_id_add'); - --- DELETE FROM bi.Last_buy_id; -TRUNCATE TABLE bi.Last_buy_id; - - --- Primero metemos las del futuro, por si no hay en el presente - -INSERT INTO bi.Last_buy_id SELECT * FROM - (SELECT - Id_Article, Id_Compra, warehouse_id - FROM - vn2008.Compres c - JOIN vn2008.Entradas e USING (Id_Entrada) - JOIN vn2008.travel tr ON tr.id = e.travel_id - WHERE - Novincular = FALSE AND tarifa2 > 0 AND NOT Redada - AND landing > curdate() - ORDER BY landing DESC) t1 -GROUP BY Id_Article , warehouse_id; - --- Ahora el presente machaca al futuro - -REPLACE bi.Last_buy_id SELECT * FROM - (SELECT - Id_Article, Id_Compra, warehouse_id - FROM - vn2008.Compres c - JOIN vn2008.Entradas e USING (Id_Entrada) - JOIN vn2008.travel tr ON tr.id = e.travel_id - WHERE - Novincular = FALSE AND tarifa2 > 0 AND NOT Redada - AND landing BETWEEN vn2008.date_inv() AND curdate() - ORDER BY landing DESC) t1 -GROUP BY Id_Article , warehouse_id; - - TRUNCATE TABLE bi.Last_buy_idBackUp; - INSERT INTO bi.Last_buy_idBackUp - SELECT * FROM Last_buy_id; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `margenes` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `margenes`() -BEGIN - -TRUNCATE TABLE bi.margenes; - -INSERT INTO bi.margenes -SELECT Id_Article, Cantidad as Unidades, Cantidad * round(nz(Costefijo) + nz(Embalajefijo) + nz(Comisionfija) + nz(Portefijo),3) as Coste , w.name as almacen, month(landing) as Mes, year(landing) as Year, 0 as Venta -FROM vn2008.Compres C -JOIN vn2008.Entradas E using(Id_Entrada) -JOIN vn2008.travel tr on tr.id = travel_id -JOIN vn2008.warehouse w on w.id = tr.warehouse_id -LEFT JOIN vn2008.Articles A using(Id_Article) -JOIN vn2008.Tipos TP using(tipo_id) -WHERE landing between '2013-01-01' and ' 2013-12-31' -AND E.Id_Proveedor <> 4 -AND not redada -AND not inventario -union all -SELECT Id_Article, Cantidad as Unidades, 0 as Coste , w.name, month(Fecha) as Mes, year(Fecha) as Year, Cantidad * round(Preu * (100 - M.Descuento) / 100,2) as Venta -FROM vn2008.Movimientos M -JOIN vn2008.Articles A using(Id_Article) -JOIN vn2008.Tipos TP using(tipo_id) -JOIN vn2008.Tickets T using(Id_Ticket) -JOIN vn2008.Clientes C using(Id_Cliente) -JOIN vn2008.warehouse w on w.id = warehouse_id -WHERE Fecha between '2013-01-01' and ' 2013-12-31' -AND (Id_Cliente = 31 or invoice) -AND Id_Cliente NOT IN (2066,2067,2068); - -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 DROP PROCEDURE IF EXISTS `nightly_tasks` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nightly_tasks`() -BEGIN - -call bi.analisis_ventas_evolution_add; - -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 DROP PROCEDURE IF EXISTS `nigthlyAnalisisVentas` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `nigthlyAnalisisVentas`() -BEGIN - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('analisis ventas START'); - - CALL bi.analisis_ventas_update; - CALL bi.analisis_ventas_simple; - CALL bi.analisis_ventas_evolution_add; - - INSERT INTO vn2008.daily_task_log(consulta) VALUES('analisis ventas END'); - -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 DROP PROCEDURE IF EXISTS `partitioning` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `partitioning`(IN intyear INT) -BEGIN - - DECLARE v_sql TEXT; - DECLARE strSquemaName VARCHAR(10); - DECLARE strTableName VARCHAR(20); - DECLARE strFieldName VARCHAR(20); - DECLARE strDateField VARCHAR(20); - DECLARE strTableDependingOn VARCHAR(20); - DECLARE strFieldDependingOn VARCHAR(20); - DECLARE done BIT DEFAULT 0; - DECLARE strCacheSchema VARCHAR(5); - DECLARE dat_start,dat_end DATE; - DECLARE cur1 CURSOR FOR - SELECT `schema_name`,`table_name` FROM `cache`.partitioning_information ORDER BY execution_order; - DECLARE cur2 CURSOR FOR - SELECT `schema_name`,`table_name`,`date_field` FROM `cache`.partitioning_information WHERE date_field > '' ORDER BY execution_order; - DECLARE cur3 CURSOR FOR - SELECT `schema_name`,`table_name`,`table_depending` FROM `cache`.partitioning_information WHERE table_depending > '' ORDER BY execution_order; - DECLARE cur4 CURSOR FOR - SELECT `schema_name`,`table_name`,`table_depending` FROM `cache`.partitioning_information WHERE table_depending > '' ORDER BY execution_order DESC; - DECLARE cur5 CURSOR FOR - SELECT `schema_name`,`table_name`,`date_field` FROM `cache`.partitioning_information WHERE date_field > '' ORDER BY execution_order DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - - SET FOREIGN_KEY_CHECKS=0; - IF LENGTH(intyear) <> 4 THEN - CALL el_año_debe_contener_4_caracteres_yyyy(); - END IF; - SET dat_start = STR_TO_DATE(CONCAT('01,01,',intyear),'%d,%m,%Y'); - SET dat_end = STR_TO_DATE(CONCAT('31,12,',intyear),'%d,%m,%Y'); - SET strCacheSchema = CONCAT('vn_',right(intyear,2)); - SET v_sql = sql_printf ('CREATE SCHEMA IF NOT EXISTS %t',strCacheSchema); - CALL vn2008.sql_query (v_sql); - - -- Insertamos en las tablas del cur1 - OPEN cur1; - FETCH cur1 INTO strSquemaName,strTableName; - WHILE NOT done DO - SET v_sql = sql_printf ('CREATE TABLE IF NOT EXISTS %t.%t LIKE %t.%t', - strCacheSchema, - strTableName, - strSquemaName, - strTableName); - - CALL vn2008.sql_query (v_sql); - - FETCH cur1 INTO strSquemaName,strTableName; - - END WHILE; - CLOSE cur1; - - -- Insertamos en las tablas del cur2 - OPEN cur2; - FETCH cur2 INTO strSquemaName,strTableName,strDateField; - WHILE NOT done DO - SET v_sql = sql_printf ('REPLACE INTO %t.%t SELECT * FROM %t.%t WHERE %t BETWEEN %v AND %v', - strCacheSchema, - strTableName, - strSquemaName, - strTableName, - strDateField, - dat_start, - dat_end); - - SELECT v_sql; - CALL vn2008.sql_query (v_sql); - - FETCH cur2 INTO strSquemaName,strTableName,strDateField; - - END WHILE; - CLOSE cur2; - - -- Insertamos en las tablas del cur3 - OPEN cur3; - SET done = 0; - FETCH cur3 INTO strSquemaName,strTableName,strTableDependingOn; - WHILE NOT done DO - - - -- Torna la columna per la qual vincular amb el seu pare - SELECT kcu.column_name INTO strFieldName - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci - AND REFERENCED_TABLE_NAME = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci - AND table_name = CONVERT(strTableName USING utf8) COLLATE utf8_general_ci; + r.fecha > '2014-12-31' + AND r.proveedor_id = idPROV + AND idMONEDA IN (r.moneda_id, 0) + AND idEMP IN (r.empresa_id,0) + GROUP BY r.id - -- Torna la columna per la qual vincular amb el seu fill - SELECT kcu.column_name INTO strFieldDependingOn - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci -- FIX mirar l'esquema del pare - AND constraint_name = 'PRIMARY' - AND table_name = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci; - - SET v_sql = sql_printf ('REPLACE INTO %t.%t SELECT a.* FROM %t.%t a JOIN %t.%t b ON a.%t = b.%t', - strCacheSchema, - strTableName, - strSquemaName, - strTableName, - strCacheSchema, - strTableDependingOn, - strFieldName, - strFieldDependingOn); - select v_sql; - CALL vn2008.sql_query (v_sql); - - FETCH cur3 INTO strSquemaName,strTableName,strTableDependingOn; - END WHILE; - - CLOSE cur3; - - -- Borramos en las tablas del cur4 que es igual que el dos pero en sentido descendente - -- para evitar errores con las foreign key - OPEN cur4; - SET done = 0; - FETCH cur4 INTO strSquemaName,strTableName,strTableDependingOn; - WHILE NOT done DO - - - -- Torna la columna per la qual vincular amb el seu pare - SELECT kcu.column_name INTO strFieldName - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci - AND REFERENCED_TABLE_NAME = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci - AND table_name = CONVERT(strTableName USING utf8) COLLATE utf8_general_ci; - - -- Torna la columna per la qual vincular amb el seu fill - SELECT kcu.column_name INTO strFieldDependingOn - FROM information_schema.key_column_usage kcu - WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci - AND constraint_name = 'PRIMARY' - AND table_name = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci; - - SELECT v_sql; - SET v_sql = sql_printf ('DELETE a.* FROM %t.%t a JOIN %t.%t b ON a.%t = b.%t', - strSquemaName, - strTableName, - strCacheSchema, - strTableDependingOn, - strFieldName, - strFieldDependingOn); - CALL vn2008.sql_query (v_sql); - - FETCH cur4 INTO strSquemaName,strTableName,strTableDependingOn; - END WHILE; - - CLOSE cur4; - - -- Borramos en las tablas del cur5 - OPEN cur5; - SET done = 0; - FETCH cur5 INTO strSquemaName,strTableName,strDateField; - WHILE NOT done DO - - SET v_sql = sql_printf ('DELETE FROM %t WHERE %t BETWEEN %v AND %v', - strTableName, - strDateField, - dat_start, - dat_end); - CALL vn2008.sql_query (v_sql); - - FETCH cur5 INTO strSquemaName,strTableName,strDateField; - - END WHILE; - CLOSE cur5; - SET FOREIGN_KEY_CHECKS=1; -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 DROP PROCEDURE IF EXISTS `primer_pedido_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `primer_pedido_add`() -BEGIN - INSERT IGNORE INTO bi.primer_pedido(Id_Ticket, Id_Cliente, month, year, total) - SELECT * - FROM - (SELECT - `m`.`Id_Ticket` , - `v`.`Id_Cliente` , - `t`.`month`, - `t`.`year`, - v.importe + v.recargo as total - FROM - bs.ventas v - JOIN - vn2008.Movimientos m on m.Id_Movimiento = v.Id_Movimiento - JOIN - vn2008.time t on t.date = v.fecha - WHERE - fecha > CURDATE() + INTERVAL -(1) YEAR - ORDER BY fecha) `s` - GROUP BY `s`.`Id_Cliente`; -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 DROP PROCEDURE IF EXISTS `regularidad` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `regularidad`() -BEGIN - -select Id_Cliente, Meses, IF(Antiguedad = 13,12,Antiguedad) , Meses / IF(Antiguedad = 13,12,Antiguedad) as Regularidad from ( -SELECT Id_Cliente, count(*) as Meses, FLOOR(DATEDIFF('2012-07-31', IF(Created < '2011-08-01','2011-08-01', Created)) / 30) +1 as Antiguedad from -( - -SELECT DISTINCT Id_Cliente, Periodo(Fecha) as periodo from Facturas -where Fecha between '2011-08-01' AND '2012-07-31' - -) sub - -join Clientes using(Id_Cliente) -where Created <= '2012-07-31' - -group by Id_Cliente -having Antiguedad > 0 - -) sub44 -order by Antiguedad ; - - -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 DROP PROCEDURE IF EXISTS `rotacion_update` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update`() -BEGIN - --- control -INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.rotation_update'); - --- Sólo hace la consulta gorda los sábados de madrugada. Necesita casi dos horas. - -IF DAY(CURDATE()) = 5 THEN - - call rotacion_update_manual(1, 999999, TIMESTAMPADD(YEAR,-1,CURDATE()), CURDATE()) ; - -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 DROP PROCEDURE IF EXISTS `rotacion_update_manual` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update_manual`(IN intART_DESDE INT, IN intART_HASTA INT, IN datSTART DATE, IN datEND DATE) -BEGIN - - -DECLARE intLAPSO INT DEFAULT DATEDIFF(datEND,datSTART ); - - - - - REPLACE bi.rotacion(Id_Article,warehouse_id,total,rotacion) - SELECT Id_Article, warehouse_id, Total, round((sum(Saldo_Ponderado)/Total),2) as rotacion -- round(avg(Saldo_Ponderado) / (Total / intLAPSO),1) as Rotacion - FROM - ( - SELECT Id_Article, warehouse_id, - @intervalo:= IF(warehouse_id = @wh AND Id_Article = @art , DATEDIFF(Fecha, @fec),1) as Dias, - IF(warehouse_id = @wh AND Id_Article = @art , IF(@sd < 0,0,@sd) * @intervalo, IF(Unidades<0,0,Unidades)) as Saldo_Ponderado, - IF(warehouse_id = @wh AND Id_Article = @art , @sd:= @sd + Unidades, @sd:= Unidades) as Saldo - - , @fec:= Fecha, @art:= Id_Article, @wh:= warehouse_id - FROM - ( - SELECT Id_Article, landing as Fecha, sum(Cantidad) as Unidades, warehouse_id, @fec:= datSTART, @art := 0, @d := 0, @sd:= 0, @wh := 0, @intervalo := 0 - FROM - ( - SELECT Id_Article, landing, Cantidad, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id - WHERE landing between datSTART and datEND - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND r.display <> 0 - AND NOT E.Inventario - AND NOT fuente - AND NOT redada - UNION ALL - SELECT Id_Article, shipment, -Cantidad, warehouse_id_out - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id_out - WHERE shipment between datSTART and datEND - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND r.display <> 0 - AND NOT fuente - AND NOT E.Inventario - AND NOT redada - UNION ALL - SELECT Id_Article, date(Fecha), -Cantidad, warehouse_id - FROM vn2008.Movimientos M - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.Tickets t using(Id_Ticket) - JOIN vn2008.warehouse w on w.id = t.warehouse_id - WHERE Fecha between datSTART and datEND - AND r.display <> 0 - AND NOT fuente - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Cliente NOT IN (2066,2067,2068) - ) sub - GROUP BY Id_Article, warehouse_id, Fecha - ) sub2 - ) sub4 - JOIN - ( - SELECT Id_Article, sum(Cantidad) as Total, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id - LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id - WHERE landing between datSTART and datEND - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND NOT E.Inventario - AND r.display <> 0 - AND NOT redada - AND NOT fuente - GROUP BY Id_Article, warehouse_id - ) sub3 using(Id_Article, warehouse_id) - - GROUP BY Id_Article, warehouse_id; - - - - CALL vn2008.item_last_buy_(NULL,datSTART); - - -- Añadimos el volumen por unidad de venta - update bi.rotacion r - JOIN vn2008.t_item_last_buy b ON r.Id_Article = b.item_id AND r.warehouse_id = b.warehouse_id - join vn2008.Compres ON Id_Compra = b.buy_id - set cm3 = vn2008.cm3_2(Id_Cubo, r.Id_Article) / Packing - where r.Id_Article between intART_DESDE and intART_HASTA; - --- Añadimos el coste de almacenamiento y manipulacion -UPDATE bi.rotacion -JOIN ( - SELECT warehouse_id, sum(total*rotacion*cm3) as Operacion - FROM bi.rotacion - WHERE Id_Article between intART_DESDE and intART_HASTA - GROUP BY warehouse_id - ) sub using(warehouse_id) - -JOIN ( - SELECT warehouse_id, sum(Valor) as Coste_Auxiliar - FROM bi.tarifa_warehouse - WHERE Id_Premisa = 1 - GROUP BY warehouse_id - ) sub2 using(warehouse_id) - -JOIN ( - SELECT warehouse_id, sum(Valor) as Coste_Operativo - FROM bi.tarifa_warehouse - WHERE Id_Premisa IN (2,3) - GROUP BY warehouse_id - ) sub3 using(warehouse_id) - -JOIN ( - SELECT warehouse_id, sum(Valor) as Coste_Manipulacion - FROM bi.tarifa_warehouse - WHERE Id_Premisa = 4 - GROUP BY warehouse_id - ) sub4 using(warehouse_id) - -SET auxiliar = if(rotacion < 0,0,round(rotacion *cm3 * Coste_Auxiliar / Operacion,4)) - ,almacenaje = if(rotacion < 0,0,round(rotacion *cm3 * Coste_Operativo / Operacion,4)) - , manipulacion = if(rotacion < 0,0,round(rotacion *cm3 * Coste_Manipulacion / Operacion,4)) - WHERE Id_Article between intART_DESDE and intART_HASTA; - - --- Añadimos todos los productos de los que no tenemos histórico, con la media de su familia como valor por defecto - -INSERT INTO bi.rotacion(Id_Article, warehouse_id, rotacion, cm3, almacenaje, manipulacion, auxiliar, mermas) -SELECT a.Id_Article, warehouse_id, rotacion_m, cm3_m, alm_m, man_m, aux_m, merm_m -FROM vn2008.Articles a -JOIN (SELECT tipo_id, warehouse_id, Id_Tipo, avg(rotacion) rotacion_m, avg(cm3) cm3_m, avg(almacenaje) alm_m, avg(manipulacion) man_m - , avg(auxiliar) aux_m, avg(mermas) merm_m - from bi.rotacion - join vn2008.Articles a using(Id_Article) - join vn2008.Tipos tp using(tipo_id) - group by tipo_id, warehouse_id) sub using(tipo_id) -WHERE a.Id_Article between intART_DESDE and intART_HASTA -ON DUPLICATE KEY UPDATE rotacion = rotacion; - -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 DROP PROCEDURE IF EXISTS `rotacion_update_manual_PCA` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update_manual_PCA`(IN datSTART DATE, IN datEND DATE) -BEGIN - - -DECLARE intLAPSO INT DEFAULT DATEDIFF(datEND,datSTART ); -DECLARE intART_DESDE BIGINT DEFAULT 1; -DECLARE intART_HASTA BIGINT DEFAULT 100; - -WHILE intART_HASTA < 999999 DO - - IF intART_HASTA MOD 1000 = 0 THEN + + UNION ALL SELECT - SELECT intART_HASTA; - - END IF; - - REPLACE bi.rotacion(Id_Article,warehouse_id,total,rotacion) - SELECT Id_Article, warehouse_id, Total, round((sum(Saldo_Ponderado)/Total),2) as rotacion -- round(avg(Saldo_Ponderado) / (Total / intLAPSO),1) as Rotacion - FROM - ( - SELECT Id_Article, warehouse_id, - @intervalo:= IF(warehouse_id = @wh AND Id_Article = @art , DATEDIFF(Fecha, @fec),1) as Dias, - IF(warehouse_id = @wh AND Id_Article = @art , IF(@sd < 0,0,@sd) * @intervalo, IF(Unidades<0,0,Unidades)) as Saldo_Ponderado, - IF(warehouse_id = @wh AND Id_Article = @art , @sd:= @sd + Unidades, @sd:= Unidades) as Saldo - - , @fec:= Fecha, @art:= Id_Article, @wh:= warehouse_id - FROM - ( - SELECT Id_Article, landing as Fecha, sum(Cantidad) as Unidades, warehouse_id, @fec:= datSTART, @art := 0, @d := 0, @sd:= 0, @wh := 0, @intervalo := 0 - FROM - ( - SELECT Id_Article, landing, Cantidad, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id - WHERE landing between datSTART and datEND - AND warehouse_id = 44 - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND reino_id IN (3,4) - AND NOT E.Inventario - AND NOT fuente - AND NOT redada - UNION ALL - SELECT Id_Article, shipment, -Cantidad, warehouse_id_out - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id_out - WHERE shipment between datSTART and datEND - AND warehouse_id_out = 44 - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND reino_id IN (3,4) - AND NOT fuente - AND NOT E.Inventario - AND NOT redada - UNION ALL - SELECT Id_Article, date(Fecha), -Cantidad, warehouse_id - FROM vn2008.Movimientos M - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.Tickets t using(Id_Ticket) - JOIN vn2008.warehouse w on w.id = t.warehouse_id - WHERE Fecha between datSTART and datEND - AND t.warehouse_id = 44 - AND reino_id IN (3,4) - AND NOT fuente - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Cliente NOT IN (2066,2067,2068) - ) sub - GROUP BY Id_Article, warehouse_id, Fecha - ) sub2 - ) sub4 - JOIN - ( - SELECT Id_Article, sum(Cantidad) as Total, warehouse_id - FROM vn2008.Compres C - JOIN vn2008.Entradas E using(Id_Entrada) - JOIN vn2008.Articles A using(Id_Article) - JOIN vn2008.Tipos using(tipo_id) - JOIN vn2008.travel tr on tr.id = travel_id - JOIN vn2008.warehouse w on w.id = tr.warehouse_id - WHERE landing between datSTART and datEND - AND warehouse_id = 44 - AND Id_Article between intART_DESDE and intART_HASTA - AND Id_Proveedor <> 4 - AND NOT E.Inventario - AND reino_id IN (3,4) - AND NOT redada - AND NOT fuente - GROUP BY Id_Article, warehouse_id - ) sub3 using(Id_Article, warehouse_id) - GROUP BY Id_Article, warehouse_id; - -SET intART_DESDE = intART_DESDE + 100; -SET intART_DESDE = intART_HASTA + 100; - -END WHILE; - - + 'P', + p.id_banco, + p.empresa_id, + NULL, + p.id, + 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, + IFNULL(conciliado, 0), + Moneda, + pago_sdc_id + 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 = idPROV + AND idMONEDA IN (p.id_moneda,0) + AND idEMP IN (p.empresa_id,0) + ) AS SUB + ORDER BY fecha) 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 DROP PROCEDURE IF EXISTS `rotacion_volumen_update` */; +/*!50003 DROP PROCEDURE IF EXISTS `__proveedores_extracto_vtos` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -44686,387 +43243,83 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_volumen_update`(IN vIdCompra BIGINT) +CREATE DEFINER=`root`@`%` PROCEDURE `__proveedores_extracto_vtos`(IN idPROV INT, IN idMONEDA INT, IN idEMP INT) BEGIN -UPDATE bi.rotacion r -JOIN vn2008.travel tr ON r.warehouse_id = tr.warehouse_id -JOIN vn2008.Entradas e ON e.travel_id = tr.id -JOIN vn2008.Compres c ON e.Id_Entrada = c.Id_Entrada AND c.Id_Article = r.Id_Article -SET r.cm3 = vn2008.cm3_2(c.Id_Cubo, c.Id_Article) / c.Packing -where c.Id_Compra = vIdCompra; -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 DROP PROCEDURE IF EXISTS `rutas_m3_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `rutas_m3_add`() -BEGIN +SET @saldo_eur:= 0; +SET @saldo_div:= 0; - DECLARE datSTART DATE DEFAULT TIMESTAMPADD(DAY,-90,CURDATE()); - DECLARE datEND DATE DEFAULT CURDATE(); - DECLARE datFEC DATE; - - IF hour(now()) between 5 and 24 then - - SET datSTART = CURDATE(); - SET datEND = TIMESTAMPADD(DAY,1,CURDATE()); - - end if; - - SET datFEC = datSTART; - - CALL vn2008.item_last_buy_(NULL,CURDATE()); - WHILE datFEC <= datEND DO - - UPDATE vn2008.Rutas R - JOIN (SELECT R.Id_Ruta, sum(Cantidad * vn2008.cm3_unidad(b.buy_id)) / 1000000 as m3 - from vn2008.Rutas R - join vn2008.Tickets t using(Id_Ruta) - join vn2008.Movimientos m using(Id_Ticket) - join vn2008.t_item_last_buy b ON Id_Article = b.item_id AND b.warehouse_id = t.warehouse_id - where R.Fecha = datFEC AND R.m3 IS NULL - group by R.Id_Ruta - ) t using(Id_Ruta) - SET R.m3 = t.m3 - WHERE R.m3 IS NULL; - - SET datFEC = TIMESTAMPADD(DAY,1,datFEC); - - END WHILE; - -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 DROP PROCEDURE IF EXISTS `ticket_add2kk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_add2kk`(intNUMDAYS INTEGER) -BEGIN - -DECLARE datSTART,datEND DATETIME; --- Seleccionamos los tickets a tratar añadiendolos a la tabla bi.ticket - - SET @@session.max_sp_recursion_depth=250; -- Habilito la recursión en mysql hasta un límite de 250. - SET datSTART = TIMESTAMPADD(DAY, -intNUMDAYS, CURDATE()); - - - SET datEND = vn2008.DAYEND(datSTART); - - - - - -- Actualiza el valor de costfixat en Movimientos a efectos estadisticos -update vn2008.Movimientos m -join -( -select Id_Movimiento, round(IFNULL(sum(Valor) , IFNULL( Preu * (100 - m.Descuento) /100,0 ) ),2) as Cost -from vn2008.Tickets t -join vn2008.Movimientos m using(Id_Ticket) -left join vn2008.Movimientos_componentes mc using(Id_Movimiento) -join bi.tarifa_componentes tc using(Id_Componente) -join bi.tarifa_componentes_series tcs on tcs.tarifa_componentes_series_id = tc.tarifa_componentes_series_id AND tcs.base -where t.Fecha between datSTART AND datEND -group by Id_Movimiento -) sub using(Id_Movimiento) -set CostFixat = Cost; - - - - - REPLACE INTO bi.ticket(Id_Ticket,Id_Cliente,`date`, tipo_id, `year`,`week`,`month`,`day`,`view`,amount,Id_Trabajador,Id_propietario ) - SELECT t.Id_Ticket,c.Id_Cliente,t.Fecha `date`,tipo_id, year(Fecha) as `year`, vn2008.vnweek(Fecha) as `week`, - month(Fecha) as `month`,vn2008.vnday(Fecha) as `day`, A.Vista `view`, - IFNULL( round( sum(cantidad * Preu * (100 - m.Descuento)/100) ,2) ,0) as amount, - c.Id_Trabajador, c.Id_Trabajador - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs using(Id_Consigna) - JOIN vn2008.warehouse W ON W.id = t.warehouse_id - INNER JOIN vn2008.Clientes c on cs.Id_Cliente = c.Id_Cliente - INNER JOIN vn2008.Movimientos m USING(Id_Ticket) - INNER JOIN vn2008.Articles USING(Id_Article) - INNER JOIN vn2008.Agencias A on A.Id_Agencia = t.Id_Agencia - INNER JOIN vn2008.Tipos TP USING(tipo_id) - WHERE Fecha BETWEEN datSTART AND datEND - AND NOT W.fuente - AND c.`Real` - AND (reino_id <> 6 OR m.Id_Article IN (95,98)) - GROUP BY t.Id_Ticket,tipo_id ; - - /* - UPDATE bi.ticket - JOIN vn2008.Tickets using(Id_Ticket) - JOIN vn2008.Agencias using(Id_Agencia) - JOIN vn2008.agency_warehouse aw using(agency_id,warehouse_id) - SET `view` = aw.Vista - WHERE Tickets.Fecha BETWEEN datSTART AND datEND; - */ - - - - IF (intNUMDAYS>0) THEN - CALL `bi`.`ticket_add2` (intNUMDAYS-1); - 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 DROP PROCEDURE IF EXISTS `ticket_addkk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_addkk`(intNUMDAYS INTEGER) -BEGIN - -DECLARE datSTART DATETIME; - - IF (intNUMDAYS > 0) THEN - SET datSTART = TIMESTAMPADD(DAY, -intNUMDAYS, CURDATE()); - DELETE FROM bi.ticket where `date` >= datSTART ; - CALL `bi`.`ticket_add2` (intNUMDAYS); - DELETE FROM bi.ticket where `date` < '2001-01-01'; - END IF; - -UPDATE bi.ticket bt -JOIN vn2008.Tickets USING(Id_Ticket) -JOIN vn2008.Consignatarios C USING(Id_Consigna) -SET bt.Id_Cliente = C.Id_Cliente -, bt.Id_Trabajador = @idT := vn2008.Averiguar_ComercialCliente_Id(C.Id_Cliente,bt.date) -, bt.Id_propietario = @idT -WHERE Tickets.Id_Cliente = 31 AND bt.date >= datSTART; - - --- Almacena los tickets que comisionan, para consultas rapidas - -truncate table bi.f_tvc; - -insert into bi.f_tvc -select Id_Ticket -from vn2008.Tickets t -join vn2008.Consignatarios cs using(Id_Consigna) -join vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente -join vn2008.warehouse w on w.id = t.warehouse_id -where c.`Real` = TRUE -and w.comisionantes = TRUE; - - - - --- Quita las horas de los tickets del mes anterior -IF DAY(CURDATE()) = 15 THEN - update vn2008.Tickets - set Fecha = date(Fecha) - where Fecha between TIMESTAMPADD(DAY,-46,CURDATE()) and TIMESTAMPADD(DAY, -1 - DAY(CURDATE()), CURDATE()); - 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 DROP PROCEDURE IF EXISTS `ticket_add_bydaykk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_add_bydaykk`(datFEC DATE) -BEGIN - - DECLARE datSTART DATETIME; - DECLARE datEND DATETIME; - --- Seleccionamos los tickets a tratar añadiendolos a la tabla bi.ticket - - SET @@session.max_sp_recursion_depth=2500; -- Habilito la recursión en mysql hasta un límite de 2500. - - SET datSTART = DATE(datFEC); - SET datEND = TIMESTAMPADD(DAY,30,datSTART); - - DELETE FROM bi.ticket WHERE `date` between datSTART and datEND; - - INSERT INTO bi.ticket(Id_Ticket,`date`, tipo_id, `year`,`week`,`month`,`view`,amount,Id_Trabajador, Id_Cliente, Id_Propietario ) - SELECT t.Id_Ticket,t.Fecha `date`,tipo_id, vn2008.vnyear(Fecha) as `year`, vn2008.vnweek(Fecha) as `week`, - vn2008.vnmonth(Fecha) as `month`, A.Vista `view`, IFNULL(round(sum(cantidad * preu * (100 - m.Descuento)/100),2),0) as amount, - c.Id_Trabajador, c.Id_Cliente, ifnull(c.Id_Trabajador,20) - FROM vn2008.Tickets t - JOIN vn2008.Consignatarios cs using(Id_Consigna) - JOIN vn2008.warehouse W ON W.id = t.warehouse_id - INNER JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - INNER JOIN vn2008.Movimientos m USING(Id_Ticket) - INNER JOIN vn2008.Articles USING(Id_Article) - INNER JOIN vn2008.Agencias A on A.Id_Agencia = t.Id_Agencia - INNER JOIN vn2008.Tipos TP USING(tipo_id) - LEFT JOIN vn2008.reinos r ON r.id = TP.reino_id - WHERE Fecha >= datSTART - AND Fecha < datEND - AND NOT W.fuente - AND (invoice or t.Id_Cliente in (5,31)) - AND r.display <> 0 - GROUP BY t.Id_Ticket,tipo_id - ON DUPLICATE KEY UPDATE amount = amount, - `view` = `view`, - `date` = `date`, - `week` = `week`, - `year` = `year`, - `month` = `month`, - tipo_id = tipo_id, - Id_Trabajador = Id_Trabajador, - Id_Cliente = Id_Cliente, - Id_Propietario = ifnull(Id_Trabajador,20); - - UPDATE bi.ticket - JOIN vn2008.Tickets using(Id_Ticket) - JOIN vn2008.Agencias using(Id_Agencia) - JOIN vn2008.agency_warehouse aw using(agency_id,warehouse_id) - SET `view` = aw.Vista - WHERE Tickets.Fecha BETWEEN datSTART AND datEND; - -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 DROP PROCEDURE IF EXISTS `Ultima_Accion` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Ultima_Accion`() -BEGIN - -REPLACE INTO bi.lastaction(Id_Cliente, Cliente, Ultima_accion, Comercial) - -SELECT Id_Cliente, Cliente, Ultima_accion, Comercial -FROM vn2008.Clientes -JOIN -( -SELECT Id_Cliente, MAX(calldate) as Ultima_accion, vn2008.Averiguar_ComercialCliente(Id_Cliente, CURDATE()) as Comercial +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 Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Contactos CT on CT.Telefono = dst -JOIN vn2008.Relaciones using(Id_Contacto) -WHERE Id_Cliente IS NOT NULL -AND duration > 30 -UNION ALL -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Contactos CT on CT.Movil = dst -JOIN vn2008.Relaciones using(Id_Contacto) -WHERE Id_Cliente IS NOT NULL -AND duration > 30 -UNION ALL -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Clientes CT on CT.Telefono = dst -WHERE duration > 30 -UNION ALL -SELECT Id_Cliente, calldate -FROM vn2008.cdr -JOIN vn2008.Clientes CT on CT.Movil = dst -WHERE duration > 30 -UNION ALL -SELECT C.Id_Cliente, Fecha -FROM vn2008.Tickets JOIN vn2008.Consignatarios C using(Id_Consigna) -) sub -GROUP BY Id_Cliente ) sub2 USING(Id_Cliente); -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 DROP PROCEDURE IF EXISTS `Velocity_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `Velocity_Add`() -BEGIN - -DECLARE bol_EXISTS BOOL; -DECLARE datMAX DATETIME; -DECLARE v_buffer VARCHAR(11); -DECLARE v_sql VARCHAR(255); - - - -SELECT MAX(Fecha) INTO datMAX FROM bi.Velocity; - -IF Date(datMAX) = CURDATE() AND hour(datMAX) > hour(now()) THEN - - - SET v_buffer = vn2008.buffer_name(CURDATE(),1); - - SELECT count(*) INTO bol_EXISTS FROM information_schema.`TABLES` - WHERE TABLE_NAME = CONVERT(v_buffer using utf8) collate utf8_general_ci; - - IF bol_EXISTS THEN - - SET v_sql = sql_printf ( - 'INSERT INTO bi.Velocity(tipo_id, Fecha, Disponible, Visible) - SELECT A.tipo_id, NOW(), sum(avalaible), sum(visible) - FROM vn2008.%t b - JOIN Articles A ON b.item_id = A.Id_Article GROUP BY tipo_id; - ', - v_buffer - ); - + (SELECT + * + FROM + (SELECT + 'V', + NULL as banco_id, + r.empresa_id, + r.serie, + r.id, + rv.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 + 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 = idPROV + AND idMONEDA IN (r.moneda_id, 0) + AND idEMP IN (r.empresa_id,0) + GROUP BY rv.id - CALL sql_query (v_sql); - - END IF; - -END IF; - + + + UNION ALL SELECT + + 'P', + p.id_banco, + p.empresa_id, + NULL, + p.id, + 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, + IFNULL(conciliado, 0), + Moneda, + pago_sdc_id + 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 = idPROV + AND idMONEDA IN (p.id_moneda,0) + AND idEMP IN (p.empresa_id,0) + ) AS SUB + ORDER BY fecha, id) t; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45083,20 +43336,21 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `vn` /*!40100 DEFAULT CHARACTER SET utf USE `vn`; -- --- Temporary view structure for view `accounting` +-- Temporary table structure for view `accounting` -- DROP TABLE IF EXISTS `accounting`; /*!50001 DROP VIEW IF EXISTS `accounting`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `accounting` AS SELECT - 1 AS `id`, - 1 AS `bank`, - 1 AS `account`, - 1 AS `accountingTypeFk`, - 1 AS `entityFk`, - 1 AS `isActive`*/; +/*!50001 CREATE TABLE `accounting` ( + `id` tinyint NOT NULL, + `bank` tinyint NOT NULL, + `account` tinyint NOT NULL, + `accountingTypeFk` tinyint NOT NULL, + `entityFk` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45131,35 +43385,31 @@ CREATE TABLE `activityTaxDismissed` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `address` +-- Temporary table structure for view `address` -- DROP TABLE IF EXISTS `address`; /*!50001 DROP VIEW IF EXISTS `address`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `address` AS SELECT - 1 AS `customer`, - 1 AS `warehouse`, - 1 AS `street`, - 1 AS `city`, - 1 AS `province`, - 1 AS `postalCode`, - 1 AS `phone`, - 1 AS `celular`, - 1 AS `nickname`, - 1 AS `id`, - 1 AS `defaultAddress`, - 1 AS `agency`, - 1 AS `active`, - 1 AS `longitude`, - 1 AS `latitude`, - 1 AS `clientFk`, - 1 AS `warehouseFk`, - 1 AS `provinceFk`, - 1 AS `mobile`, - 1 AS `agencyFk`, - 1 AS `isEqualizated`*/; +/*!50001 CREATE TABLE `address` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `postalCode` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `phone` tinyint NOT NULL, + `mobile` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `isDefaultAddress` tinyint NOT NULL, + `longitude` tinyint NOT NULL, + `latitude` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `isEqualizated` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45178,100 +43428,124 @@ CREATE TABLE `addressForPackaging` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `addressObservation` +-- Temporary table structure for view `addressObservation` -- DROP TABLE IF EXISTS `addressObservation`; /*!50001 DROP VIEW IF EXISTS `addressObservation`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `addressObservation` AS SELECT - 1 AS `id`, - 1 AS `addressFk`, - 1 AS `observationTypeFk`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `addressObservation` ( + `id` tinyint NOT NULL, + `addressFk` tinyint NOT NULL, + `observationTypeFk` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `agency` +-- Temporary table structure for view `agency` -- DROP TABLE IF EXISTS `agency`; /*!50001 DROP VIEW IF EXISTS `agency`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `agency` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `warehouse`, - 1 AS `warehouseFk`, - 1 AS `isVolumetric`, - 1 AS `bank`, - 1 AS `bankFk`, - 1 AS `warehouseNickname`, - 1 AS `warehouseAliasFk`, - 1 AS `own`, - 1 AS `labelZone`*/; +/*!50001 CREATE TABLE `agency` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `isVolumetric` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `warehouseAliasFk` tinyint NOT NULL, + `own` tinyint NOT NULL, + `labelZone` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `agencyHour` +-- Temporary table structure for view `agencyHour` -- DROP TABLE IF EXISTS `agencyHour`; /*!50001 DROP VIEW IF EXISTS `agencyHour`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `agencyHour` AS SELECT - 1 AS `id`, - 1 AS `agency`, - 1 AS `weekDay`, - 1 AS `warehouse`, - 1 AS `province`, - 1 AS `substractDay`, - 1 AS `maxHour`*/; +/*!50001 CREATE TABLE `agencyHour` ( + `id` tinyint NOT NULL, + `agency` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `weekDay` tinyint NOT NULL, + `warehouse` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `province` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `substractDay` tinyint NOT NULL, + `maxHour` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `agencyMode` +-- Temporary table structure for view `agencyMode` -- DROP TABLE IF EXISTS `agencyMode`; /*!50001 DROP VIEW IF EXISTS `agencyMode`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `agencyMode` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `description`, - 1 AS `view`, - 1 AS `deliveryMethod`, - 1 AS `m3`, - 1 AS `cod71`, - 1 AS `web`, - 1 AS `agency`, - 1 AS `agencyFk`, - 1 AS `agencyService`, - 1 AS `agencyServiceFk`, - 1 AS `inflacion`, - 1 AS `isVolumetric`, - 1 AS `reportMail`*/; +/*!50001 CREATE TABLE `agencyMode` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `description` tinyint NOT NULL, + `deliveryMethodFk` tinyint NOT NULL, + `deliveryMethod` tinyint NOT NULL, + `view` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `cod71` tinyint NOT NULL, + `web` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `agency` tinyint NOT NULL, + `agencyServiceFk` tinyint NOT NULL, + `agencyService` tinyint NOT NULL, + `inflation` tinyint NOT NULL, + `inflacion` tinyint NOT NULL, + `isVolumetric` tinyint NOT NULL, + `reportMail` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `agencyWarehouse` +-- Temporary table structure for view `agencyWarehouse` -- 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`*/; +/*!50001 CREATE TABLE `agencyWarehouse` ( + `agencyFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `agencyType` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `autoRadioConfig` +-- + +DROP TABLE IF EXISTS `autoRadioConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `autoRadioConfig` ( + `id` int(11) NOT NULL, + `password` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `port` int(11) DEFAULT NULL, + `url` varchar(75) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `autonomousRegion` -- @@ -45287,54 +43561,75 @@ CREATE TABLE `autonomousRegion` ( PRIMARY KEY (`id`), KEY `countryFk` (`countryFk`), CONSTRAINT `countryFk` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `awb` +-- Temporary table structure for view `awb` -- DROP TABLE IF EXISTS `awb`; /*!50001 DROP VIEW IF EXISTS `awb`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `awb` AS SELECT - 1 AS `id`, - 1 AS `code`, - 1 AS `package`, - 1 AS `weight`, - 1 AS `created`, - 1 AS `transitoryFk`, - 1 AS `taxFk`, - 1 AS `docFk`, - 1 AS `amount`, - 1 AS `freightFk`, - 1 AS `m3`, - 1 AS `stems`, - 1 AS `flightFk`, - 1 AS `volumeWeight`, - 1 AS `hb`, - 1 AS `rate`, - 1 AS `booked`, - 1 AS `issued`, - 1 AS `operated`*/; +/*!50001 CREATE TABLE `awb` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `package` tinyint NOT NULL, + `weight` tinyint NOT NULL, + `created` tinyint NOT NULL, + `transitoryFk` tinyint NOT NULL, + `taxFk` tinyint NOT NULL, + `docFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `freightFk` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `stems` tinyint NOT NULL, + `flightFk` tinyint NOT NULL, + `volumeWeight` tinyint NOT NULL, + `hb` tinyint NOT NULL, + `rate` tinyint NOT NULL, + `booked` tinyint NOT NULL, + `issued` tinyint NOT NULL, + `operated` tinyint NOT NULL, + `bookEntried` tinyint NOT NULL, + `invoiceInFk` tinyint NOT NULL, + `isChecked` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `bank` +-- Temporary table structure for view `bank` -- DROP TABLE IF EXISTS `bank`; /*!50001 DROP VIEW IF EXISTS `bank`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `bank` AS SELECT - 1 AS `id`, - 1 AS `bank`, - 1 AS `account`, - 1 AS `cash`, - 1 AS `entityFk`, - 1 AS `isActive`*/; +/*!50001 CREATE TABLE `bank` ( + `id` tinyint NOT NULL, + `bank` tinyint NOT NULL, + `account` tinyint NOT NULL, + `cash` tinyint NOT NULL, + `entityFk` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `bankEntity` +-- + +DROP TABLE IF EXISTS `bankEntity`; +/*!50001 DROP VIEW IF EXISTS `bankEntity`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `bankEntity` ( + `id` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `name` tinyint NOT NULL, + `bic` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45348,72 +43643,125 @@ CREATE TABLE `bookingPlanner` ( `id` int(10) NOT NULL AUTO_INCREMENT, `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `pgcFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `taxAreaFk` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'SPAIN', + `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT 'SPAIN', `priority` int(2) unsigned DEFAULT NULL, `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '1', `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`), - KEY `taxArea_bookingPlanner_idx` (`taxAreaFk`), KEY `pgcFk_bookingPlanner_idx` (`pgcFk`), KEY `taxClassFk` (`taxClassFk`), KEY `countryFk` (`countryFk`), + KEY `bookingPlannerTaxArea` (`taxAreaFk`), + CONSTRAINT `bookingPlannerTaxArea` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE, CONSTRAINT `bookingPlanner_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE, CONSTRAINT `bookingPlanner_ibfk_2` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON DELETE CASCADE, - CONSTRAINT `bookingPlanner_ibfk_3` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON DELETE CASCADE, - CONSTRAINT `taxArea_bookingPlanner` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `bookingPlanner_ibfk_3` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `botanicExport` +-- Temporary table structure for view `botanicExport` -- DROP TABLE IF EXISTS `botanicExport`; /*!50001 DROP VIEW IF EXISTS `botanicExport`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `botanicExport` AS SELECT - 1 AS `id`, - 1 AS `ediGenusFk`, - 1 AS `ediSpecieFk`, - 1 AS `countryFk`, - 1 AS `restriction`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `botanicExport` ( + `id` tinyint NOT NULL, + `ediGenusFk` tinyint NOT NULL, + `ediSpecieFk` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `restriction` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `buy` +-- Temporary table structure for view `buy` -- DROP TABLE IF EXISTS `buy`; /*!50001 DROP VIEW IF EXISTS `buy`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `buy` AS SELECT - 1 AS `id`, - 1 AS `entryFk`, - 1 AS `itemFk`, - 1 AS `amount`, - 1 AS `buyingValue`, - 1 AS `quantity`, - 1 AS `packageFk`, - 1 AS `stickers`, - 1 AS `freightValue`, - 1 AS `packageValue`, - 1 AS `comissionValue`, - 1 AS `packing`, - 1 AS `grouping`, - 1 AS `groupingMode`, - 1 AS `location`, - 1 AS `price1`, - 1 AS `price2`, - 1 AS `price3`, - 1 AS `minPrice`, - 1 AS `producer`, - 1 AS `printedStickers`, - 1 AS `isChecked`*/; +/*!50001 CREATE TABLE `buy` ( + `id` tinyint NOT NULL, + `entryFk` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `buyingValue` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `packageFk` tinyint NOT NULL, + `stickers` tinyint NOT NULL, + `freightValue` tinyint NOT NULL, + `packageValue` tinyint NOT NULL, + `comissionValue` tinyint NOT NULL, + `packing` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `groupingMode` tinyint NOT NULL, + `location` tinyint NOT NULL, + `price1` tinyint NOT NULL, + `price2` tinyint NOT NULL, + `price3` tinyint NOT NULL, + `minPrice` tinyint NOT NULL, + `producer` tinyint NOT NULL, + `printedStickers` tinyint NOT NULL, + `isChecked` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `calendarHolidays` +-- + +DROP TABLE IF EXISTS `calendarHolidays`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendarHolidays` ( + `calendarHolidaysTypeFk` int(11) NOT NULL, + `dated` date NOT NULL, + `calendarHolidaysNameFk` int(11) DEFAULT NULL, + `workCenterFk` int(11) NOT NULL, + PRIMARY KEY (`dated`,`workCenterFk`), + KEY `calendarholidaystypeFk_idx` (`calendarHolidaysTypeFk`), + KEY `calendarHolidaysNameFk_idx` (`calendarHolidaysNameFk`), + KEY `workCenterFk_idx` (`workCenterFk`), + CONSTRAINT `calendarHolidaysNameFk` FOREIGN KEY (`calendarHolidaysNameFk`) REFERENCES `calendarHolidaysName` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `calendarholidaystypeFk` FOREIGN KEY (`calendarHolidaysTypeFk`) REFERENCES `calendarHolidaysType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workCenterFk` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendarHolidaysName` +-- + +DROP TABLE IF EXISTS `calendarHolidaysName`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendarHolidaysName` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendarHolidaysType` +-- + +DROP TABLE IF EXISTS `calendarHolidaysType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendarHolidaysType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `hexColour` char(7) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `category` -- @@ -45426,89 +43774,97 @@ CREATE TABLE `category` ( `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `nick` varchar(3) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `city` +-- Temporary table structure for view `city` -- DROP TABLE IF EXISTS `city`; /*!50001 DROP VIEW IF EXISTS `city`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `city` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `provinceFk`*/; +/*!50001 CREATE TABLE `city` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `client` +-- Temporary table structure for view `client` -- DROP TABLE IF EXISTS `client`; /*!50001 DROP VIEW IF EXISTS `client`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `client` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `fi`, - 1 AS `phone`, - 1 AS `fax`, - 1 AS `email`, - 1 AS `iban`, - 1 AS `dueDay`, - 1 AS `accountingAccount`, - 1 AS `isEqualizated`, - 1 AS `city`, - 1 AS `province`, - 1 AS `provinceFk`, - 1 AS `postcode`, - 1 AS `socialName`, - 1 AS `contact`, - 1 AS `Reexpedicion`, - 1 AS `hasToInvoice`, - 1 AS `Notas`, - 1 AS `notas_administracion`, - 1 AS `Copiafactura`, - 1 AS `Retener`, - 1 AS `Congelado`, - 1 AS `Id_Trabajador`, - 1 AS `workerFk`, - 1 AS `credit`, - 1 AS `cyc`, - 1 AS `Id_Pais`, - 1 AS `countryFk`, - 1 AS `activo`, - 1 AS `active`, - 1 AS `gestdoc`, - 1 AS `gestdocFk`, - 1 AS `calidad`, - 1 AS `paymentMethod`, - 1 AS `paymentMethodFk`, - 1 AS `registerDate`, - 1 AS `invoiceByEmail`, - 1 AS `isToBeMailed`, - 1 AS `channel`, - 1 AS `channelFk`, - 1 AS `VIES`, - 1 AS `sepavnl`, - 1 AS `corevnl`, - 1 AS `riskCalculated`, - 1 AS `corevnh`, - 1 AS `clientes_tipo_id`, - 1 AS `clientTypeFk`, - 1 AS `postcode_id`, - 1 AS `postcodeFk`, - 1 AS `mail_address`, - 1 AS `codpos`, - 1 AS `cplusTerIdNifFk`, - 1 AS `postalAddress`, - 1 AS `invoiceByAddress`, - 1 AS `isTaxDataChecked`, - 1 AS `isFreezed`*/; +/*!50001 CREATE TABLE `client` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `fi` tinyint NOT NULL, + `socialName` tinyint NOT NULL, + `contact` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `postcode` tinyint NOT NULL, + `phone` tinyint NOT NULL, + `mobile` tinyint NOT NULL, + `fax` tinyint NOT NULL, + `isRelevant` tinyint NOT NULL, + `email` tinyint NOT NULL, + `iban` tinyint NOT NULL, + `dueDay` tinyint NOT NULL, + `accountingAccount` tinyint NOT NULL, + `isEqualizated` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `hasToInvoice` tinyint NOT NULL, + `credit` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `isActive` tinyint NOT NULL, + `gestdocFk` tinyint NOT NULL, + `quality` tinyint NOT NULL, + `payMethodFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `isToBeMailed` tinyint NOT NULL, + `contactChannelFk` tinyint NOT NULL, + `hasSepaVnl` tinyint NOT NULL, + `hasCoreVnl` tinyint NOT NULL, + `hasCoreVnh` tinyint NOT NULL, + `defaultAddressFk` tinyint NOT NULL, + `riskCalculated` tinyint NOT NULL, + `clientTypeFk` tinyint NOT NULL, + `mailAddress` tinyint NOT NULL, + `cplusTerIdNifFk` tinyint NOT NULL, + `hasToInvoiceByAddress` tinyint NOT NULL, + `isTaxDataChecked` tinyint NOT NULL, + `isFreezed` tinyint NOT NULL, + `creditInsurance` tinyint NOT NULL, + `isCreatedAsServed` tinyint NOT NULL, + `hasInvoiceSimplified` tinyint NOT NULL, + `salesPersonFk` tinyint NOT NULL, + `isVies` tinyint NOT NULL, + `eypbc` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `clientCredit` +-- + +DROP TABLE IF EXISTS `clientCredit`; +/*!50001 DROP VIEW IF EXISTS `clientCredit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `clientCredit` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `__employeeFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45527,60 +43883,185 @@ CREATE TABLE `clientCreditLimit` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `clientManaCache` +-- 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 TABLE `clientDefaultCompany` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `started` tinyint NOT NULL, + `finished` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `clientLog` +-- + +DROP TABLE IF EXISTS `clientLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=147609 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `clientManaCache` -- DROP TABLE IF EXISTS `clientManaCache`; /*!50001 DROP VIEW IF EXISTS `clientManaCache`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientManaCache` AS SELECT - 1 AS `clientFk`, - 1 AS `mana`, - 1 AS `dated`*/; +/*!50001 CREATE TABLE `clientManaCache` ( + `clientFk` tinyint NOT NULL, + `mana` tinyint NOT NULL, + `dated` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `clientObservation` +-- Temporary table structure for view `clientNotification` +-- + +DROP TABLE IF EXISTS `clientNotification`; +/*!50001 DROP VIEW IF EXISTS `clientNotification`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `clientNotification` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `clientNotificationTypeFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `userFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `clientNotificationType` +-- + +DROP TABLE IF EXISTS `clientNotificationType`; +/*!50001 DROP VIEW IF EXISTS `clientNotificationType`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `clientNotificationType` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `description` tinyint NOT NULL, + `isVisible` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `clientObservation` -- DROP TABLE IF EXISTS `clientObservation`; /*!50001 DROP VIEW IF EXISTS `clientObservation`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientObservation` AS SELECT - 1 AS `id`, - 1 AS `client`, - 1 AS `worker`, - 1 AS `text`, - 1 AS `creationDate`*/; +/*!50001 CREATE TABLE `clientObservation` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `text` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `clientType` +-- Temporary table structure for view `clientType` -- DROP TABLE IF EXISTS `clientType`; /*!50001 DROP VIEW IF EXISTS `clientType`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientType` AS SELECT - 1 AS `id`, - 1 AS `code`, - 1 AS `type`*/; +/*!50001 CREATE TABLE `clientType` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `type` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `company` +-- Temporary table structure for view `color` +-- + +DROP TABLE IF EXISTS `color`; +/*!50001 DROP VIEW IF EXISTS `color`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `color` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `company` -- DROP TABLE IF EXISTS `company`; /*!50001 DROP VIEW IF EXISTS `company`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `company` AS SELECT - 1 AS `id`, - 1 AS `code`*/; +/*!50001 CREATE TABLE `company` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `supplierAccountFk` tinyint NOT NULL, + `CodigoEmpresa` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `comparative` +-- + +DROP TABLE IF EXISTS `comparative`; +/*!50001 DROP VIEW IF EXISTS `comparative`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `comparative` ( + `timePeriod` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `price` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `comparativeFilter` +-- + +DROP TABLE IF EXISTS `comparativeFilter`; +/*!50001 DROP VIEW IF EXISTS `comparativeFilter`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `comparativeFilter` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `whereSql` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45594,7 +44075,7 @@ CREATE TABLE `confectionType` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45610,26 +44091,41 @@ CREATE TABLE `config` ( `fakeEmail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `defaultersMaxAmount` int(10) DEFAULT '200' COMMENT 'maxima deuda permitida a partir de la cual se bloquea a un usuario', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `country` +-- Temporary table structure for view `contactChannel` +-- + +DROP TABLE IF EXISTS `contactChannel`; +/*!50001 DROP VIEW IF EXISTS `contactChannel`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `contactChannel` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `country` -- DROP TABLE IF EXISTS `country`; /*!50001 DROP VIEW IF EXISTS `country`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `country` AS SELECT - 1 AS `id`, - 1 AS `country`, - 1 AS `CEE`, - 1 AS `isUeeMember`, - 1 AS `Code`, - 1 AS `currencyFk`, - 1 AS `politicalCountryFk`, - 1 AS `geoFk`*/; +/*!50001 CREATE TABLE `country` ( + `id` tinyint NOT NULL, + `country` tinyint NOT NULL, + `CEE` tinyint NOT NULL, + `isUeeMember` tinyint NOT NULL, + `code` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `politicalCountryFk` tinyint NOT NULL, + `geoFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45643,7 +44139,7 @@ CREATE TABLE `cplusCorrectingType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45774,7 +44270,7 @@ CREATE TABLE `creditClassification` ( KEY `creditClassifClientFk_idx` (`client`), KEY `creditClassifdateEnd_idx` (`dateEnd`), CONSTRAINT `creditClassifClientFk` FOREIGN KEY (`client`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2641 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -45819,7 +44315,7 @@ CREATE TABLE `creditInsurance` ( PRIMARY KEY (`id`), KEY `CreditInsurance_Fk1_idx` (`creditClassification`), CONSTRAINT `CreditInsurance_Fk1` FOREIGN KEY (`creditClassification`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; +) ENGINE=InnoDB AUTO_INCREMENT=1701 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -45845,6 +44341,21 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +-- +-- Temporary table structure for view `currency` +-- + +DROP TABLE IF EXISTS `currency`; +/*!50001 DROP VIEW IF EXISTS `currency`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `currency` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `dailyTaskLog` -- @@ -45878,91 +44389,134 @@ CREATE TABLE `deliveryError` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `deliveryMethod` +-- Temporary table structure for view `deliveryMethod` -- DROP TABLE IF EXISTS `deliveryMethod`; /*!50001 DROP VIEW IF EXISTS `deliveryMethod`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `deliveryMethod` AS SELECT - 1 AS `id`, - 1 AS `code`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `deliveryMethod` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ediGenus` +-- Temporary table structure for view `ediGenus` -- DROP TABLE IF EXISTS `ediGenus`; /*!50001 DROP VIEW IF EXISTS `ediGenus`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ediGenus` AS SELECT - 1 AS `id`, - 1 AS `latinGenusName`, - 1 AS `entried`, - 1 AS `dued`, - 1 AS `modified`*/; +/*!50001 CREATE TABLE `ediGenus` ( + `id` tinyint NOT NULL, + `latinGenusName` tinyint NOT NULL, + `entried` tinyint NOT NULL, + `dued` tinyint NOT NULL, + `modified` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ediSpecie` +-- Temporary table structure for view `ediSpecie` -- DROP TABLE IF EXISTS `ediSpecie`; /*!50001 DROP VIEW IF EXISTS `ediSpecie`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ediSpecie` AS SELECT - 1 AS `id`, - 1 AS `genusFk`, - 1 AS `latinSpeciesName`, - 1 AS `entried`, - 1 AS `dued`, - 1 AS `modified`*/; +/*!50001 CREATE TABLE `ediSpecie` ( + `id` tinyint NOT NULL, + `genusFk` tinyint NOT NULL, + `latinSpeciesName` tinyint NOT NULL, + `entried` tinyint NOT NULL, + `dued` tinyint NOT NULL, + `modified` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `entry` +-- Temporary table structure for view `entity` +-- + +DROP TABLE IF EXISTS `entity`; +/*!50001 DROP VIEW IF EXISTS `entity`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `entity` ( + `countryFk` tinyint NOT NULL, + `id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `bic` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `entry` -- DROP TABLE IF EXISTS `entry`; /*!50001 DROP VIEW IF EXISTS `entry`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `entry` AS SELECT - 1 AS `id`, - 1 AS `supplierFk`, - 1 AS `ref`, - 1 AS `isInventory`, - 1 AS `isConfirmed`, - 1 AS `isOrdered`, - 1 AS `isRaid`, - 1 AS `commission`, - 1 AS `created`, - 1 AS `evaNotes`, - 1 AS `travelFk`, - 1 AS `currencyFk`, - 1 AS `companyFk`, - 1 AS `gestDocFk`, - 1 AS `invoiceReceivedFk`*/; +/*!50001 CREATE TABLE `entry` ( + `id` tinyint NOT NULL, + `supplierFk` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `isInventory` tinyint NOT NULL, + `isConfirmed` tinyint NOT NULL, + `isOrdered` tinyint NOT NULL, + `isRaid` tinyint NOT NULL, + `commission` tinyint NOT NULL, + `created` tinyint NOT NULL, + `evaNotes` tinyint NOT NULL, + `travelFk` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `gestDocFk` tinyint NOT NULL, + `invoiceReceivedFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `especialPrice` +-- Table structure for table `entryLog` +-- + +DROP TABLE IF EXISTS `entryLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `entryLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `userFk` (`userFk`), + KEY `logEntry_ibfk_1` (`originFk`), + CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=25664 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `especialPrice` -- DROP TABLE IF EXISTS `especialPrice`; /*!50001 DROP VIEW IF EXISTS `especialPrice`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `especialPrice` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `itemFk`, - 1 AS `value`*/; +/*!50001 CREATE TABLE `especialPrice` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `value` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -45977,150 +44531,239 @@ CREATE TABLE `excuse` ( `txt` varchar(255) CHARACTER SET latin1 NOT NULL, `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `expedition` +-- Temporary table structure for view `expedition` -- DROP TABLE IF EXISTS `expedition`; /*!50001 DROP VIEW IF EXISTS `expedition`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `expedition` AS SELECT - 1 AS `id`, - 1 AS `agency`, - 1 AS `agencyFk`, - 1 AS `ticket`, - 1 AS `ticketFk`, - 1 AS `isBox`, - 1 AS `printingTime`, - 1 AS `item`, - 1 AS `itemFk`, - 1 AS `counter`, - 1 AS `checked`, - 1 AS `workerFk`*/; +/*!50001 CREATE TABLE `expedition` ( + `id` tinyint NOT NULL, + `agency` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `agencyModeFk` tinyint NOT NULL, + `ticket` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `isBox` tinyint NOT NULL, + `printingTime` tinyint NOT NULL, + `item` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `counter` tinyint NOT NULL, + `checked` tinyint NOT NULL, + `workerFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `expence` +-- Temporary table structure for view `expence` -- DROP TABLE IF EXISTS `expence`; /*!50001 DROP VIEW IF EXISTS `expence`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `expence` AS SELECT - 1 AS `id`, - 1 AS `taxTypeFk`, - 1 AS `name`, - 1 AS `isWithheld`*/; +/*!50001 CREATE TABLE `expence` ( + `id` tinyint NOT NULL, + `taxTypeFk` tinyint NOT NULL, + `name` tinyint NOT NULL, + `isWithheld` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `family` +-- Temporary table structure for view `firstTicketShipped` -- -DROP TABLE IF EXISTS `family`; -/*!50001 DROP VIEW IF EXISTS `family`*/; +DROP TABLE IF EXISTS `firstTicketShipped`; +/*!50001 DROP VIEW IF EXISTS `firstTicketShipped`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `family` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `life`*/; +/*!50001 CREATE TABLE `firstTicketShipped` ( + `shipped` tinyint NOT NULL, + `clientFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `grant` +-- Table structure for table `gateArea` +-- + +DROP TABLE IF EXISTS `gateArea`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gateArea` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `grant` -- DROP TABLE IF EXISTS `grant`; /*!50001 DROP VIEW IF EXISTS `grant`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `grant` AS SELECT - 1 AS `group`, - 1 AS `worker`, - 1 AS `company`*/; +/*!50001 CREATE TABLE `grant` ( + `group` tinyint NOT NULL, + `worker` tinyint NOT NULL, + `company` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `grantGroup` +-- 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 `observationType`*/; +/*!50001 CREATE TABLE `grantGroup` ( + `id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `observationType` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ink` +-- Temporary table structure for view `greuge` +-- + +DROP TABLE IF EXISTS `greuge`; +/*!50001 DROP VIEW IF EXISTS `greuge`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `greuge` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `description` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `created` tinyint NOT NULL, + `greugeTypeFk` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `greugeType` +-- + +DROP TABLE IF EXISTS `greugeType`; +/*!50001 DROP VIEW IF EXISTS `greugeType`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `greugeType` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ink` -- DROP TABLE IF EXISTS `ink`; /*!50001 DROP VIEW IF EXISTS `ink`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ink` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `picture`*/; +/*!50001 CREATE TABLE `ink` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `picture` tinyint NOT NULL, + `showOrder` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `intrastat` +-- Table structure for table `inkI18n` +-- + +DROP TABLE IF EXISTS `inkI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `inkI18n` ( + `inkFk` char(3) COLLATE utf8_unicode_ci NOT NULL, + `lang` char(2) CHARACTER SET utf8 NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`inkFk`,`lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `inkL10n` +-- + +DROP TABLE IF EXISTS `inkL10n`; +/*!50001 DROP VIEW IF EXISTS `inkL10n`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `inkL10n` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +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 `id`, - 1 AS `description`, - 1 AS `taxGroupFk`, - 1 AS `taxCodeFk`*/; +/*!50001 CREATE TABLE `intrastat` ( + `id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `taxClassFk` tinyint NOT NULL, + `taxCodeFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `invoiceCorrection` +-- 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 `cplusInvoiceType477Fk`, - 1 AS `invoiceCorrectionTypeFk`*/; +/*!50001 CREATE TABLE `invoiceCorrection` ( + `correctingFk` tinyint NOT NULL, + `correctedFk` tinyint NOT NULL, + `cplusRectificationTypeFk` tinyint NOT NULL, + `cplusInvoiceType477Fk` tinyint NOT NULL, + `invoiceCorrectionTypeFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `invoiceCorrectionDataSource` +-- Temporary table structure for view `invoiceCorrectionDataSource` -- DROP TABLE IF EXISTS `invoiceCorrectionDataSource`; /*!50001 DROP VIEW IF EXISTS `invoiceCorrectionDataSource`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceCorrectionDataSource` AS SELECT - 1 AS `itemFk`, - 1 AS `quantity`, - 1 AS `concept`, - 1 AS `price`, - 1 AS `discount`, - 1 AS `refFk`, - 1 AS `saleFk`*/; +/*!50001 CREATE TABLE `invoiceCorrectionDataSource` ( + `itemFk` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `price` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `refFk` tinyint NOT NULL, + `saleFk` tinyint NOT NULL, + `shipped` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46135,81 +44778,105 @@ CREATE TABLE `invoiceCorrectionType` ( `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `description_UNIQUE` (`description`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `invoiceIn` +-- Temporary table structure for view `invoiceIn` -- DROP TABLE IF EXISTS `invoiceIn`; /*!50001 DROP VIEW IF EXISTS `invoiceIn`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceIn` AS SELECT - 1 AS `id`, - 1 AS `serialNumber`, - 1 AS `serial`, - 1 AS `supplierFk`, - 1 AS `issued`, - 1 AS `supplierRef`, - 1 AS `isBooked`, - 1 AS `currencyFk`, - 1 AS `created`, - 1 AS `companyFk`, - 1 AS `docFk`, - 1 AS `booked`, - 1 AS `operated`, - 1 AS `cplusInvoiceType472Fk`, - 1 AS `cplusRectificationTypeFk`, - 1 AS `cplusSubjectOpFk`, - 1 AS `cplusTaxBreakFk`, - 1 AS `cplusTrascendency472Fk`*/; +/*!50001 CREATE TABLE `invoiceIn` ( + `id` tinyint NOT NULL, + `serialNumber` tinyint NOT NULL, + `serial` tinyint NOT NULL, + `supplierFk` tinyint NOT NULL, + `issued` tinyint NOT NULL, + `supplierRef` tinyint NOT NULL, + `isBooked` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `docFk` tinyint NOT NULL, + `booked` tinyint NOT NULL, + `operated` tinyint NOT NULL, + `cplusInvoiceType472Fk` tinyint NOT NULL, + `cplusRectificationTypeFk` tinyint NOT NULL, + `cplusSubjectOpFk` tinyint NOT NULL, + `cplusTaxBreakFk` tinyint NOT NULL, + `cplusTrascendency472Fk` tinyint NOT NULL, + `bookEntried` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `invoiceInAwb` +-- Temporary table structure for view `invoiceInAwb` -- DROP TABLE IF EXISTS `invoiceInAwb`; /*!50001 DROP VIEW IF EXISTS `invoiceInAwb`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceInAwb` AS SELECT - 1 AS `invoiceInFk`, - 1 AS `awbFk`, - 1 AS `dua`*/; +/*!50001 CREATE TABLE `invoiceInAwb` ( + `invoiceInFk` tinyint NOT NULL, + `awbFk` tinyint NOT NULL, + `dua` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `invoiceInEntry` +-- Temporary table structure for view `invoiceInDueDay` +-- + +DROP TABLE IF EXISTS `invoiceInDueDay`; +/*!50001 DROP VIEW IF EXISTS `invoiceInDueDay`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `invoiceInDueDay` ( + `id` tinyint NOT NULL, + `invoiceInFk` tinyint NOT NULL, + `dueDated` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `divisa` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `invoiceInEntry` -- DROP TABLE IF EXISTS `invoiceInEntry`; /*!50001 DROP VIEW IF EXISTS `invoiceInEntry`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceInEntry` AS SELECT - 1 AS `id`, - 1 AS `invoiceInFk`, - 1 AS `entryFk`, - 1 AS `percentage`, - 1 AS `invoiceInAwbFk`, - 1 AS `isBooked`*/; +/*!50001 CREATE TABLE `invoiceInEntry` ( + `id` tinyint NOT NULL, + `invoiceInFk` tinyint NOT NULL, + `entryFk` tinyint NOT NULL, + `percentage` tinyint NOT NULL, + `invoiceInAwbFk` tinyint NOT NULL, + `isBooked` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `invoiceInIntrastat` +-- Temporary table structure for view `invoiceInIntrastat` -- DROP TABLE IF EXISTS `invoiceInIntrastat`; /*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceInIntrastat` AS SELECT - 1 AS `invoiceInFk`, - 1 AS `intrastatFk`, - 1 AS `amount`*/; +/*!50001 CREATE TABLE `invoiceInIntrastat` ( + `invoiceInFk` tinyint NOT NULL, + `intrastatFk` tinyint NOT NULL, + `amount` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46223,54 +44890,59 @@ CREATE TABLE `invoiceInSerial` ( `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `cplusTerIdNifFk` int(11) NOT NULL DEFAULT '1', + `taxAreaFk` varchar(15) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`code`), KEY `InvoiceInSerial_Fk1_idx` (`cplusTerIdNifFk`), + KEY `InvoiceInSerialTaxArea_idx` (`taxAreaFk`), + CONSTRAINT `InvoiceInSerialTaxArea` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE, CONSTRAINT `InvoiceInSerial_Fk1` FOREIGN KEY (`cplusTerIdNifFk`) REFERENCES `cplusTerIdNif` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `invoiceInTax` +-- Temporary table structure for view `invoiceInTax` -- DROP TABLE IF EXISTS `invoiceInTax`; /*!50001 DROP VIEW IF EXISTS `invoiceInTax`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceInTax` AS SELECT - 1 AS `id`, - 1 AS `invoiceInFk`, - 1 AS `taxCodeFk`, - 1 AS `taxableBase`, - 1 AS `expenceFk`, - 1 AS `foreignValue`, - 1 AS `created`*/; +/*!50001 CREATE TABLE `invoiceInTax` ( + `id` tinyint NOT NULL, + `invoiceInFk` tinyint NOT NULL, + `taxCodeFk` tinyint NOT NULL, + `taxableBase` tinyint NOT NULL, + `expenceFk` tinyint NOT NULL, + `foreignValue` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `invoiceOut` +-- Temporary table structure for view `invoiceOut` -- DROP TABLE IF EXISTS `invoiceOut`; /*!50001 DROP VIEW IF EXISTS `invoiceOut`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceOut` AS SELECT - 1 AS `id`, - 1 AS `ref`, - 1 AS `serial`, - 1 AS `issued`, - 1 AS `amount`, - 1 AS `clientFk`, - 1 AS `created`, - 1 AS `companyFk`, - 1 AS `dued`, - 1 AS `booked`, - 1 AS `cplusInvoiceType477Fk`, - 1 AS `cplusTaxBreakFk`, - 1 AS `cplusSubjectOpFk`, - 1 AS `cplusTrascendency477Fk`, - 1 AS `pdf`*/; +/*!50001 CREATE TABLE `invoiceOut` ( + `id` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `serial` tinyint NOT NULL, + `issued` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `dued` tinyint NOT NULL, + `booked` tinyint NOT NULL, + `cplusInvoiceType477Fk` tinyint NOT NULL, + `cplusTaxBreakFk` tinyint NOT NULL, + `cplusSubjectOpFk` tinyint NOT NULL, + `cplusTrascendency477Fk` tinyint NOT NULL, + `pdf` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46292,7 +44964,7 @@ CREATE TABLE `invoiceOutExpence` ( KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_FK_2` FOREIGN KEY (`expenceFk`) REFERENCES `vn2008`.`Gastos` (`Id_Gasto`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; +) ENGINE=InnoDB AUTO_INCREMENT=45525 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46306,11 +44978,12 @@ CREATE TABLE `invoiceOutSerial` ( `code` varchar(2) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `isTaxed` tinyint(1) NOT NULL DEFAULT '1', - `taxAreaFk` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'NATIONAL', + `taxAreaFk` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT 'NATIONAL', `isCEE` tinyint(1) NOT NULL DEFAULT '0', + `cplusInvoiceType477Fk` int(10) unsigned DEFAULT '1', PRIMARY KEY (`code`), KEY `taxAreaFk_idx` (`taxAreaFk`), - CONSTRAINT `invoiceOutSerial_ibfk_1` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON DELETE CASCADE + CONSTRAINT `invoiceOutSeriaTaxArea` FOREIGN KEY (`taxAreaFk`) REFERENCES `taxArea` (`code`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -46334,58 +45007,127 @@ CREATE TABLE `invoiceOutTax` ( KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=855644 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `item` +-- Temporary table structure for view `item` -- DROP TABLE IF EXISTS `item`; /*!50001 DROP VIEW IF EXISTS `item`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `item` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `familyFk`, - 1 AS `size`, - 1 AS `inkFk`, - 1 AS `category`, - 1 AS `stems`, - 1 AS `originFk`, - 1 AS `description`, - 1 AS `producerFk`, - 1 AS `intrastatFk`, - 1 AS `expenceFk`*/; +/*!50001 CREATE TABLE `item` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `typeFk` tinyint NOT NULL, + `size` tinyint NOT NULL, + `inkFk` tinyint NOT NULL, + `category` tinyint NOT NULL, + `stems` tinyint NOT NULL, + `originFk` tinyint NOT NULL, + `description` tinyint NOT NULL, + `producerFk` tinyint NOT NULL, + `intrastatFk` tinyint NOT NULL, + `isOnOffer` tinyint NOT NULL, + `expenceFk` tinyint NOT NULL, + `isBargain` tinyint NOT NULL, + `comment` tinyint NOT NULL, + `relevancy` tinyint NOT NULL, + `image` tinyint NOT NULL, + `taxClassFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemBotanical` +-- Temporary table structure for view `itemBarcode` +-- + +DROP TABLE IF EXISTS `itemBarcode`; +/*!50001 DROP VIEW IF EXISTS `itemBarcode`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemBarcode` ( + `id` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `code` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `itemBotanical` -- DROP TABLE IF EXISTS `itemBotanical`; /*!50001 DROP VIEW IF EXISTS `itemBotanical`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemBotanical` AS SELECT - 1 AS `itemFk`, - 1 AS `botanical`, - 1 AS `genusFk`, - 1 AS `specieFk`*/; +/*!50001 CREATE TABLE `itemBotanical` ( + `itemFk` tinyint NOT NULL, + `botanical` tinyint NOT NULL, + `genusFk` tinyint NOT NULL, + `specieFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `itemBotanicalWithGenus` +-- Temporary table structure for view `itemBotanicalWithGenus` -- DROP TABLE IF EXISTS `itemBotanicalWithGenus`; /*!50001 DROP VIEW IF EXISTS `itemBotanicalWithGenus`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemBotanicalWithGenus` AS SELECT - 1 AS `itemFk`, - 1 AS `ediBotanic`*/; +/*!50001 CREATE TABLE `itemBotanicalWithGenus` ( + `itemFk` tinyint NOT NULL, + `ediBotanic` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `itemCategory` +-- + +DROP TABLE IF EXISTS `itemCategory`; +/*!50001 DROP VIEW IF EXISTS `itemCategory`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemCategory` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `display` tinyint NOT NULL, + `color` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `itemCategoryI18n` +-- + +DROP TABLE IF EXISTS `itemCategoryI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemCategoryI18n` ( + `categoryFk` int(10) unsigned NOT NULL, + `lang` char(2) CHARACTER SET utf8 NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`categoryFk`,`lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `itemCategoryL10n` +-- + +DROP TABLE IF EXISTS `itemCategoryL10n`; +/*!50001 DROP VIEW IF EXISTS `itemCategoryL10n`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemCategoryL10n` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46406,20 +45148,39 @@ CREATE TABLE `itemConversor` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemTag` +-- Temporary table structure for view `itemPlacement` +-- + +DROP TABLE IF EXISTS `itemPlacement`; +/*!50001 DROP VIEW IF EXISTS `itemPlacement`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemPlacement` ( + `itemFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `code` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `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; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemTag` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) NOT NULL, + `tagFk` int(11) NOT NULL, + `value` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `priority` int(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `priorityItem` (`itemFk`,`priority`), + KEY `tagFk` (`tagFk`,`value`), + CONSTRAINT `itemFK` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=14418 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `itemTagArranged` @@ -46448,15 +45209,16 @@ CREATE TABLE `itemTagArranged` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `itemTagged` +-- Temporary table structure for view `itemTagged` -- DROP TABLE IF EXISTS `itemTagged`; /*!50001 DROP VIEW IF EXISTS `itemTagged`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemTagged` AS SELECT - 1 AS `itemFk`*/; +/*!50001 CREATE TABLE `itemTagged` ( + `itemFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46479,9 +45241,56 @@ CREATE TABLE `itemTaxCountry` ( CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDB AUTO_INCREMENT=439744 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `itemType` +-- + +DROP TABLE IF EXISTS `itemType`; +/*!50001 DROP VIEW IF EXISTS `itemType`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemType` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `name` tinyint NOT NULL, + `categoryFk` tinyint NOT NULL, + `life` tinyint NOT NULL, + `workerFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `itemTypeI18n` +-- + +DROP TABLE IF EXISTS `itemTypeI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemTypeI18n` ( + `typeFk` smallint(5) unsigned NOT NULL, + `lang` char(2) CHARACTER SET utf8 NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`typeFk`,`lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `itemTypeL10n` +-- + +DROP TABLE IF EXISTS `itemTypeL10n`; +/*!50001 DROP VIEW IF EXISTS `itemTypeL10n`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemTypeL10n` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `itemVerdecora` -- @@ -46498,130 +45307,27 @@ CREATE TABLE `itemVerdecora` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `logClient` --- - -DROP TABLE IF EXISTS `logClient`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `logClient` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), - KEY `userFk` (`userFk`), - CONSTRAINT `logClient_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `logClient_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `logEntry` --- - -DROP TABLE IF EXISTS `logEntry`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `logEntry` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `userFk` (`userFk`), - KEY `logEntry_ibfk_1` (`originFk`), - CONSTRAINT `logEntry_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `logEntry_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `logTicket` --- - -DROP TABLE IF EXISTS `logTicket`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `logTicket` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `logTicketoriginFk` (`originFk`), - KEY `logTicketuserFk` (`userFk`), - CONSTRAINT `logTicket_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `logTicket_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `logType` --- - -DROP TABLE IF EXISTS `logType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `logType` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `originTableName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `logTableName` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `logWorker` --- - -DROP TABLE IF EXISTS `logWorker`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `logWorker` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `workerFk_idx` (`originFk`), - KEY `userFk_idx` (`userFk`), - CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `mail` +-- Temporary table structure for view `mail` -- DROP TABLE IF EXISTS `mail`; /*!50001 DROP VIEW IF EXISTS `mail`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `mail` AS SELECT - 1 AS `id`, - 1 AS `senderFk`, - 1 AS `recipientFk`, - 1 AS `sender`, - 1 AS `replyTo`, - 1 AS `subject`, - 1 AS `body`, - 1 AS `plainTextBody`, - 1 AS `attachment`, - 1 AS `creationDate`, - 1 AS `sent`, - 1 AS `status`*/; +/*!50001 CREATE TABLE `mail` ( + `id` tinyint NOT NULL, + `senderFk` tinyint NOT NULL, + `recipientFk` tinyint NOT NULL, + `sender` tinyint NOT NULL, + `replyTo` tinyint NOT NULL, + `subject` tinyint NOT NULL, + `body` tinyint NOT NULL, + `plainTextBody` tinyint NOT NULL, + `attachment` tinyint NOT NULL, + `creationDate` tinyint NOT NULL, + `sent` tinyint NOT NULL, + `status` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46636,28 +45342,79 @@ CREATE TABLE `mailTemplates` ( `name` varchar(50) CHARACTER SET utf8 NOT NULL, `attachmentPath` text CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `manaSpellers` +-- Temporary table structure for view `manaSpellers` -- DROP TABLE IF EXISTS `manaSpellers`; /*!50001 DROP VIEW IF EXISTS `manaSpellers`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `manaSpellers` AS SELECT - 1 AS `worker`, - 1 AS `size`, - 1 AS `used`, - 1 AS `pricesModifierRate`, - 1 AS `pricesModifierActivated`, - 1 AS `workerCode`, - 1 AS `firstname`, - 1 AS `name`*/; +/*!50001 CREATE TABLE `manaSpellers` ( + `worker` tinyint NOT NULL, + `size` tinyint NOT NULL, + `used` tinyint NOT NULL, + `pricesModifierRate` tinyint NOT NULL, + `pricesModifierActivated` tinyint NOT NULL, + `workerCode` tinyint NOT NULL, + `firstname` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `mandate` +-- + +DROP TABLE IF EXISTS `mandate`; +/*!50001 DROP VIEW IF EXISTS `mandate`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `mandate` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `code` tinyint NOT NULL, + `created` tinyint NOT NULL, + `finished` tinyint NOT NULL, + `mandateTypeFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `mandateType` +-- + +DROP TABLE IF EXISTS `mandateType`; +/*!50001 DROP VIEW IF EXISTS `mandateType`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `mandateType` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `manuscript` +-- + +DROP TABLE IF EXISTS `manuscript`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `manuscript` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(45) CHARACTER SET utf8 NOT NULL, + `description` text COLLATE utf8_unicode_ci, + `enabled` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `code_UNIQUE` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `message` -- @@ -46676,7 +45433,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1346492 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46698,31 +45455,57 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1490245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `movement` +-- Temporary table structure for view `movement` -- DROP TABLE IF EXISTS `movement`; /*!50001 DROP VIEW IF EXISTS `movement`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `movement` AS SELECT - 1 AS `id`, - 1 AS `item`, - 1 AS `ticket`, - 1 AS `concept`, - 1 AS `amount`, - 1 AS `quantity`, - 1 AS `price`, - 1 AS `discount`, - 1 AS `cost`, - 1 AS `reservado`, - 1 AS `od`, - 1 AS `priceFixed`, - 1 AS `lastUpdate`*/; +/*!50001 CREATE TABLE `movement` ( + `id` tinyint NOT NULL, + `item` tinyint NOT NULL, + `ticket` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `price` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `cost` tinyint NOT NULL, + `reservado` tinyint NOT NULL, + `od` tinyint NOT NULL, + `priceFixed` tinyint NOT NULL, + `lastUpdate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `movementkk` +-- + +DROP TABLE IF EXISTS `movementkk`; +/*!50001 DROP VIEW IF EXISTS `movementkk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `movementkk` ( + `id` tinyint NOT NULL, + `item` tinyint NOT NULL, + `ticket` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `price` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `cost` tinyint NOT NULL, + `reservado` tinyint NOT NULL, + `od` tinyint NOT NULL, + `priceFixed` tinyint NOT NULL, + `lastUpdate` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46742,7 +45525,7 @@ CREATE TABLE `noticeCategory` ( `requiredRole` int(11) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `keyName_UNIQUE` (`keyName`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46763,55 +45546,87 @@ CREATE TABLE `noticeSubscription` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `observationType` +-- Temporary table structure for view `observationType` -- DROP TABLE IF EXISTS `observationType`; /*!50001 DROP VIEW IF EXISTS `observationType`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `observationType` AS SELECT - 1 AS `id`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `observationType` ( + `id` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `origin` +-- Temporary table structure for view `origin` -- DROP TABLE IF EXISTS `origin`; /*!50001 DROP VIEW IF EXISTS `origin`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `origin` AS SELECT - 1 AS `id`, - 1 AS `code`, - 1 AS `name`*/; +/*!50001 CREATE TABLE `origin` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `outgoingInvoice` +-- Table structure for table `originI18n` +-- + +DROP TABLE IF EXISTS `originI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `originI18n` ( + `originFk` tinyint(2) unsigned NOT NULL, + `lang` char(2) CHARACTER SET utf8 NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`originFk`,`lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `originL10n` +-- + +DROP TABLE IF EXISTS `originL10n`; +/*!50001 DROP VIEW IF EXISTS `originL10n`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `originL10n` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `outgoingInvoice` -- DROP TABLE IF EXISTS `outgoingInvoice`; /*!50001 DROP VIEW IF EXISTS `outgoingInvoice`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `outgoingInvoice` AS SELECT - 1 AS `id`, - 1 AS `serie`, - 1 AS `dateInvoice`, - 1 AS `total`, - 1 AS `dueDate`, - 1 AS `bank`, - 1 AS `client`, - 1 AS `remittance`, - 1 AS `remit`, - 1 AS `worker`, - 1 AS `creationDate`, - 1 AS `company`, - 1 AS `liquidacion?`, - 1 AS `isPdf`*/; +/*!50001 CREATE TABLE `outgoingInvoice` ( + `id` tinyint NOT NULL, + `serie` tinyint NOT NULL, + `dateInvoice` tinyint NOT NULL, + `total` tinyint NOT NULL, + `dueDate` tinyint NOT NULL, + `bank` tinyint NOT NULL, + `client` tinyint NOT NULL, + `remittance` tinyint NOT NULL, + `remit` tinyint NOT NULL, + `worker` tinyint NOT NULL, + `creationDate` tinyint NOT NULL, + `company` tinyint NOT NULL, + `liquidacion?` tinyint NOT NULL, + `isPdf` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -46831,37 +45646,166 @@ CREATE TABLE `outgoingInvoiceVat` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `package` +-- Temporary table structure for view `package` -- DROP TABLE IF EXISTS `package`; /*!50001 DROP VIEW IF EXISTS `package`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `package` AS SELECT - 1 AS `id`, - 1 AS `volume`, - 1 AS `width`, - 1 AS `height`, - 1 AS `depth`, - 1 AS `isPackageReturnable`, - 1 AS `created`, - 1 AS `itemFk`*/; +/*!50001 CREATE TABLE `package` ( + `id` tinyint NOT NULL, + `volume` tinyint NOT NULL, + `width` tinyint NOT NULL, + `height` tinyint NOT NULL, + `depth` tinyint NOT NULL, + `isPackageReturnable` tinyint NOT NULL, + `created` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `price` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `payMethod` +-- Table structure for table `packageEquivalent` +-- + +DROP TABLE IF EXISTS `packageEquivalent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packageEquivalent` ( + `packageFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `equivalentFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`packageFk`,`equivalentFk`), + KEY `packageEquivalent_fk2_idx` (`equivalentFk`), + CONSTRAINT `packageEquivalent_fk1` FOREIGN KEY (`packageFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `packageEquivalent_fk2` FOREIGN KEY (`equivalentFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='recoge los modelos de cubos que se han de sustituir a efectos de presentar informes resumidos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `packageEquivalentItem` +-- + +DROP TABLE IF EXISTS `packageEquivalentItem`; +/*!50001 DROP VIEW IF EXISTS `packageEquivalentItem`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `packageEquivalentItem` ( + `itemFk` tinyint NOT NULL, + `equivalentFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `payMethod` -- DROP TABLE IF EXISTS `payMethod`; /*!50001 DROP VIEW IF EXISTS `payMethod`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `payMethod` AS SELECT - 1 AS `id`, - 1 AS `name`*/; +/*!50001 CREATE TABLE `payMethod` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `graceDays` tinyint NOT NULL, + `outstandingDebt` tinyint NOT NULL, + `ibanRequired` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `payment` +-- + +DROP TABLE IF EXISTS `payment`; +/*!50001 DROP VIEW IF EXISTS `payment`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `payment` ( + `id` tinyint NOT NULL, + `received` tinyint NOT NULL, + `supplierFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `divisa` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `payMethod` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `paymentExchangeInsuranceFk` tinyint NOT NULL, + `isConciliate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `paymentExchangeInsurance` +-- + +DROP TABLE IF EXISTS `paymentExchangeInsurance`; +/*!50001 DROP VIEW IF EXISTS `paymentExchangeInsurance`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `paymentExchangeInsurance` ( + `id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `created` tinyint NOT NULL, + `dueDay` tinyint NOT NULL, + `entityFk` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `rate` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `financialProductTypefk` tinyint NOT NULL, + `upperBarrier` tinyint NOT NULL, + `lowerBarrier` tinyint NOT NULL, + `strike` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `payrollCenter` +-- + +DROP TABLE IF EXISTS `payrollCenter`; +/*!50001 DROP VIEW IF EXISTS `payrollCenter`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `payrollCenter` ( + `codCenter` tinyint NOT NULL, + `name` tinyint NOT NULL, + `nss` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `postcode` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `companyCode` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `person` +-- + +DROP TABLE IF EXISTS `person`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `person` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `firstname` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `surnames` varchar(60) COLLATE utf8_unicode_ci NOT NULL, + `fi` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `birth` date DEFAULT NULL, + `readerId` int(11) DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL, + `isDisable` tinyint(1) NOT NULL DEFAULT '0', + `isFreelance` tinyint(1) NOT NULL DEFAULT '0', + `isSsDiscounted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `nif` (`fi`), + KEY `nifIndex` (`fi`), + KEY `workerFk_idx` (`workerFk`) +) ENGINE=InnoDB AUTO_INCREMENT=818 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `pgc` -- @@ -46903,220 +45847,454 @@ CREATE TABLE `pgcEqu` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `plantpassport` +-- Temporary table structure for view `plantpassport` -- DROP TABLE IF EXISTS `plantpassport`; /*!50001 DROP VIEW IF EXISTS `plantpassport`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `plantpassport` AS SELECT - 1 AS `producerFk`, - 1 AS `plantpassportAuthorityFk`, - 1 AS `number`*/; +/*!50001 CREATE TABLE `plantpassport` ( + `producerFk` tinyint NOT NULL, + `plantpassportAuthorityFk` tinyint NOT NULL, + `number` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `plantpassportAuthority` +-- Temporary table structure for view `plantpassportAuthority` -- DROP TABLE IF EXISTS `plantpassportAuthority`; /*!50001 DROP VIEW IF EXISTS `plantpassportAuthority`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `plantpassportAuthority` AS SELECT - 1 AS `id`, - 1 AS `denomination`, - 1 AS `countryFk`*/; +/*!50001 CREATE TABLE `plantpassportAuthority` ( + `id` tinyint NOT NULL, + `denomination` tinyint NOT NULL, + `countryFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `priceFixed` +-- Table structure for table `postCode` +-- + +DROP TABLE IF EXISTS `postCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `postCode` ( + `code` char(5) COLLATE utf8_unicode_ci NOT NULL, + `townFk` int(11) NOT NULL, + `geoFk` int(11) DEFAULT NULL, + PRIMARY KEY (`code`,`townFk`), + KEY `postCodeTownFk_idx` (`townFk`), + CONSTRAINT `postCodeTownFk` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `priceFixed` -- DROP TABLE IF EXISTS `priceFixed`; /*!50001 DROP VIEW IF EXISTS `priceFixed`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `priceFixed` AS SELECT - 1 AS `itemFk`, - 1 AS `rate0`, - 1 AS `rate1`, - 1 AS `rate2`, - 1 AS `rate3`, - 1 AS `started`, - 1 AS `ended`, - 1 AS `bonus`, - 1 AS `warehouseFk`, - 1 AS `created`, - 1 AS `id`, - 1 AS `grouping`, - 1 AS `packing`, - 1 AS `box`*/; +/*!50001 CREATE TABLE `priceFixed` ( + `itemFk` tinyint NOT NULL, + `rate0` tinyint NOT NULL, + `rate1` tinyint NOT NULL, + `rate2` tinyint NOT NULL, + `rate3` tinyint NOT NULL, + `started` tinyint NOT NULL, + `ended` tinyint NOT NULL, + `bonus` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `id` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `packing` tinyint NOT NULL, + `box` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `printServerQueue` +-- Temporary table structure for view `printServerQueue` -- DROP TABLE IF EXISTS `printServerQueue`; /*!50001 DROP VIEW IF EXISTS `printServerQueue`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `printServerQueue` AS SELECT - 1 AS `id`, - 1 AS `printerFk`, - 1 AS `priorityFk`, - 1 AS `reportFk`, - 1 AS `statusFk`, - 1 AS `started`, - 1 AS `finished`, - 1 AS `param1`, - 1 AS `workerFk`, - 1 AS `param2`, - 1 AS `param3`, - 1 AS `error`*/; +/*!50001 CREATE TABLE `printServerQueue` ( + `id` tinyint NOT NULL, + `printerFk` tinyint NOT NULL, + `priorityFk` tinyint NOT NULL, + `reportFk` tinyint NOT NULL, + `statusFk` tinyint NOT NULL, + `started` tinyint NOT NULL, + `finished` tinyint NOT NULL, + `param1` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `param2` tinyint NOT NULL, + `param3` tinyint NOT NULL, + `error` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `printingQueue` +-- Temporary table structure for view `printingQueue` -- DROP TABLE IF EXISTS `printingQueue`; /*!50001 DROP VIEW IF EXISTS `printingQueue`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `printingQueue` AS SELECT - 1 AS `id`, - 1 AS `printer`, - 1 AS `priority`, - 1 AS `report`, - 1 AS `state`, - 1 AS `startingTime`, - 1 AS `endingTime`, - 1 AS `text`, - 1 AS `worker`, - 1 AS `text2`, - 1 AS `text3`*/; +/*!50001 CREATE TABLE `printingQueue` ( + `id` tinyint NOT NULL, + `printer` tinyint NOT NULL, + `priority` tinyint NOT NULL, + `report` tinyint NOT NULL, + `state` tinyint NOT NULL, + `startingTime` tinyint NOT NULL, + `endingTime` tinyint NOT NULL, + `text` tinyint NOT NULL, + `worker` tinyint NOT NULL, + `text2` tinyint NOT NULL, + `text3` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `producer` +-- Temporary table structure for view `producer` -- DROP TABLE IF EXISTS `producer`; /*!50001 DROP VIEW IF EXISTS `producer`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `producer` AS SELECT - 1 AS `id`, - 1 AS `name`*/; +/*!50001 CREATE TABLE `producer` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `province` +-- Table structure for table `profile` +-- + +DROP TABLE IF EXISTS `profile`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `profile` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `personFk` int(11) DEFAULT NULL, + `profileTypeFk` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + KEY `personFk` (`personFk`), + KEY `profileTypeFk` (`profileTypeFk`), + CONSTRAINT `profile_ibfk_1` FOREIGN KEY (`personFk`) REFERENCES `person` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `profile_ibfk_2` FOREIGN KEY (`profileTypeFk`) REFERENCES `profileType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=697 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `profileType` +-- + +DROP TABLE IF EXISTS `profileType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `profileType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `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 TABLE `promissoryNote` ( + `id` tinyint NOT NULL, + `Concept` tinyint NOT NULL, + `paymentFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `province` -- DROP TABLE IF EXISTS `province`; /*!50001 DROP VIEW IF EXISTS `province`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `province` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `countryFk`*/; +/*!50001 CREATE TABLE `province` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `zoneFk` tinyint NOT NULL, + `geoFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `referenceRate` +-- Temporary table structure for view `receipt` +-- + +DROP TABLE IF EXISTS `receipt`; +/*!50001 DROP VIEW IF EXISTS `receipt`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `receipt` ( + `Id` tinyint NOT NULL, + `invoiceFk` tinyint NOT NULL, + `amountPaid` tinyint NOT NULL, + `amountUnpaid` tinyint NOT NULL, + `payed` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `isConciliate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `referenceRate` -- DROP TABLE IF EXISTS `referenceRate`; /*!50001 DROP VIEW IF EXISTS `referenceRate`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `referenceRate` AS SELECT - 1 AS `currencyFk`, - 1 AS `dated`, - 1 AS `value`*/; +/*!50001 CREATE TABLE `referenceRate` ( + `currencyFk` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `value` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `role` +-- Temporary table structure for view `role` -- DROP TABLE IF EXISTS `role`; /*!50001 DROP VIEW IF EXISTS `role`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `role` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `description`, - 1 AS `hasLogin`*/; +/*!50001 CREATE TABLE `role` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `description` tinyint NOT NULL, + `hasLogin` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `route` +-- Temporary table structure for view `route` -- DROP TABLE IF EXISTS `route`; /*!50001 DROP VIEW IF EXISTS `route`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `route` AS SELECT - 1 AS `id`, - 1 AS `workerFk`, - 1 AS `created`, - 1 AS `vehicleFk`, - 1 AS `agencyFk`, - 1 AS `agencyModeFk`, - 1 AS `time`, - 1 AS `isOk`, - 1 AS `kmStart`, - 1 AS `kmEnd`, - 1 AS `started`, - 1 AS `finished`, - 1 AS `gestdocFk`, - 1 AS `cost`, - 1 AS `m3`*/; +/*!50001 CREATE TABLE `route` ( + `id` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `vehicleFk` tinyint NOT NULL, + `agencyModeFk` tinyint NOT NULL, + `time` tinyint NOT NULL, + `isOk` tinyint NOT NULL, + `kmStart` tinyint NOT NULL, + `kmEnd` tinyint NOT NULL, + `started` tinyint NOT NULL, + `finished` tinyint NOT NULL, + `gestdocFk` tinyint NOT NULL, + `cost` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `sale` +-- Table structure for table `routeGate` +-- + +DROP TABLE IF EXISTS `routeGate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeGate` ( + `deviceId` varchar(30) CHARACTER SET utf8 NOT NULL, + `displayText` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `status` set('idle','doing','done','') CHARACTER SET utf8 DEFAULT 'idle', + `gateAreaFk` int(11) NOT NULL DEFAULT '1', + `routeFk` int(11) DEFAULT NULL, + `freeTickets` int(11) DEFAULT NULL, + `expeditions` int(11) DEFAULT NULL, + `scanned` int(11) DEFAULT NULL, + `flag` blob, + `pallets` int(11) DEFAULT NULL, + `lastScanned` datetime DEFAULT NULL, + PRIMARY KEY (`deviceId`), + UNIQUE KEY `routeFk_UNIQUE` (`routeFk`), + KEY `routeGate_fk1_idx` (`gateAreaFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`routeGateBeforeUpdate` + BEFORE UPDATE ON `routeGate` + FOR EACH ROW +BEGIN + IF (NOT (NEW.expeditions <=> OLD.expeditions) + OR NOT (NEW.scanned <=> OLD.scanned)) + AND NEW.status <=> OLD.status + THEN + IF NEW.expeditions = 0 + THEN + SET NEW.status = 'idle'; + ELSEIF NEW.expeditions = NEW.scanned + THEN + SET NEW.status = 'done'; + ELSE + SET NEW.status = 'doing'; + END IF; + 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 */ ; + +-- +-- Table structure for table `routeLog` +-- + +DROP TABLE IF EXISTS `routeLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=334756 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `routesControl` +-- + +DROP TABLE IF EXISTS `routesControl`; +/*!50001 DROP VIEW IF EXISTS `routesControl`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `routesControl` ( + `routeFk` tinyint NOT NULL, + `expeditions` tinyint NOT NULL, + `scanned` tinyint NOT NULL, + `pallets` tinyint NOT NULL, + `lastScanned` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `sale` -- DROP TABLE IF EXISTS `sale`; /*!50001 DROP VIEW IF EXISTS `sale`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `sale` AS SELECT - 1 AS `id`, - 1 AS `itemFk`, - 1 AS `ticketFk`, - 1 AS `concept`, - 1 AS `quantity`, - 1 AS `price`, - 1 AS `discount`, - 1 AS `reserved`, - 1 AS `isPicked`, - 1 AS `created`*/; +/*!50001 CREATE TABLE `sale` ( + `id` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `price` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `reserved` tinyint NOT NULL, + `isPicked` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `saleComponent` +-- Temporary table structure for view `saleComponent` -- DROP TABLE IF EXISTS `saleComponent`; /*!50001 DROP VIEW IF EXISTS `saleComponent`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `saleComponent` AS SELECT - 1 AS `saleFk`, - 1 AS `componentFk`, - 1 AS `value`*/; +/*!50001 CREATE TABLE `saleComponent` ( + `saleFk` tinyint NOT NULL, + `componentFk` tinyint NOT NULL, + `value` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `sms` +-- + +DROP TABLE IF EXISTS `sms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sms` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `senderFk` int(11) NOT NULL, + `destinationFk` int(11) DEFAULT NULL, + `sender` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT '693474205', + `destination` varchar(15) CHARACTER SET utf8 NOT NULL, + `message` varchar(160) COLLATE utf8_unicode_ci NOT NULL, + `statusCode` smallint(9) NOT NULL DEFAULT '0', + `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=87656 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `smsConfig` +-- + +DROP TABLE IF EXISTS `smsConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `smsConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `uri` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `solunionCAP` -- @@ -47212,19 +46390,20 @@ DELIMITER ; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- --- Temporary view structure for view `state` +-- Temporary table structure for view `state` -- DROP TABLE IF EXISTS `state`; /*!50001 DROP VIEW IF EXISTS `state`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `state` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `order`, - 1 AS `alertLevel`, - 1 AS `code`*/; +/*!50001 CREATE TABLE `state` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `order` tinyint NOT NULL, + `alertLevel` tinyint NOT NULL, + `code` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47246,43 +46425,97 @@ CREATE TABLE `stockBuyed` ( UNIQUE KEY `date_UNIQUE` (`date`,`user`), KEY `stockBuyed_user_idx` (`user`), CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=228842 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `supplier` +-- Temporary table structure for view `supplier` -- DROP TABLE IF EXISTS `supplier`; /*!50001 DROP VIEW IF EXISTS `supplier`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `supplier` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `account`, - 1 AS `countryFk`, - 1 AS `nif`, - 1 AS `isFarmer`, - 1 AS `retAccount`, - 1 AS `commission`, - 1 AS `created`, - 1 AS `postcodeFk`, - 1 AS `isActive`*/; +/*!50001 CREATE TABLE `supplier` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `account` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `nif` tinyint NOT NULL, + `isFarmer` tinyint NOT NULL, + `retAccount` tinyint NOT NULL, + `commission` tinyint NOT NULL, + `created` tinyint NOT NULL, + `postcodeFk` tinyint NOT NULL, + `isActive` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `postCode` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `tag` +-- Temporary table structure for view `supplierAccount` +-- + +DROP TABLE IF EXISTS `supplierAccount`; +/*!50001 DROP VIEW IF EXISTS `supplierAccount`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `supplierAccount` ( + `id` tinyint NOT NULL, + `supplierFk` tinyint NOT NULL, + `iban` tinyint NOT NULL, + `bankEntityFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `tag` -- DROP TABLE IF EXISTS `tag`; -/*!50001 DROP VIEW IF EXISTS `tag`*/; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tag` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(25) CHARACTER SET utf8 NOT NULL, + `free` tinyint(1) NOT NULL DEFAULT '1', + `isQuantitatif` tinyint(4) NOT NULL DEFAULT '1', + `sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tagI18n` +-- + +DROP TABLE IF EXISTS `tagI18n`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tagI18n` ( + `tagFk` int(10) unsigned NOT NULL, + `lang` char(2) CHARACTER SET utf8 NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`tagFk`,`lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `tagL10n` +-- + +DROP TABLE IF EXISTS `tagL10n`; +/*!50001 DROP VIEW IF EXISTS `tagL10n`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `tag` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `free`*/; +/*!50001 CREATE TABLE `tagL10n` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47293,128 +46526,149 @@ DROP TABLE IF EXISTS `taxArea`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `taxArea` ( - `code` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(15) CHARACTER SET utf8 NOT NULL, + `ClaveOperacionFactura` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `CodigoTransaccion` int(2) DEFAULT NULL, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `taxClass` +-- Temporary table structure for view `taxClass` -- DROP TABLE IF EXISTS `taxClass`; /*!50001 DROP VIEW IF EXISTS `taxClass`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `taxClass` AS SELECT - 1 AS `id`, - 1 AS `description`, - 1 AS `code`*/; +/*!50001 CREATE TABLE `taxClass` ( + `id` tinyint NOT NULL, + `description` tinyint NOT NULL, + `code` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `taxClassCode` +-- Temporary table structure for view `taxClassCode` -- DROP TABLE IF EXISTS `taxClassCode`; /*!50001 DROP VIEW IF EXISTS `taxClassCode`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `taxClassCode` AS SELECT - 1 AS `taxClassFk`, - 1 AS `effectived`, - 1 AS `taxCodeFk`*/; +/*!50001 CREATE TABLE `taxClassCode` ( + `taxClassFk` tinyint NOT NULL, + `effectived` tinyint NOT NULL, + `taxCodeFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `taxCode` +-- Temporary table structure for view `taxCode` -- DROP TABLE IF EXISTS `taxCode`; /*!50001 DROP VIEW IF EXISTS `taxCode`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `taxCode` AS SELECT - 1 AS `id`, - 1 AS `dated`, - 1 AS `code`, - 1 AS `taxTypeFk`, - 1 AS `rate`, - 1 AS `equalizationTax`, - 1 AS `type`, - 1 AS `linkFk`, - 1 AS `isActive`*/; +/*!50001 CREATE TABLE `taxCode` ( + `id` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `code` tinyint NOT NULL, + `taxTypeFk` tinyint NOT NULL, + `rate` tinyint NOT NULL, + `equalizationTax` tinyint NOT NULL, + `type` tinyint NOT NULL, + `link` tinyint NOT NULL, + `isActive` tinyint NOT NULL, + `updated` tinyint NOT NULL, + `transactionCode` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `taxType` +-- Temporary table structure for view `taxType` -- DROP TABLE IF EXISTS `taxType`; /*!50001 DROP VIEW IF EXISTS `taxType`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `taxType` AS SELECT - 1 AS `id`, - 1 AS `nickname`, - 1 AS `serial`, - 1 AS `TIPOOPE`, - 1 AS `description`, - 1 AS `countryFk`*/; +/*!50001 CREATE TABLE `taxType` ( + `id` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `isAccrued` tinyint NOT NULL, + `serial` tinyint NOT NULL, + `TIPOOPE` tinyint NOT NULL, + `description` tinyint NOT NULL, + `countryFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ticket` +-- Temporary table structure for view `ticket` -- DROP TABLE IF EXISTS `ticket`; /*!50001 DROP VIEW IF EXISTS `ticket`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticket` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `warehouseFk`, - 1 AS `shipped`, - 1 AS `landed`, - 1 AS `nickname`, - 1 AS `refFk`, - 1 AS `addressFk`, - 1 AS `isSigned`, - 1 AS `location`, - 1 AS `blocked`, - 1 AS `solution`, - 1 AS `path`, - 1 AS `routeFk`, - 1 AS `company`, - 1 AS `companyFk`, - 1 AS `agencyModeFk`, - 1 AS `loadingOrder`, - 1 AS `created`, - 1 AS `shipment`, - 1 AS `landing`, - 1 AS `customer`, - 1 AS `warehouse`, - 1 AS `client`, - 1 AS `address`, - 1 AS `agencyMode`, - 1 AS `signed`, - 1 AS `creationDate`*/; +/*!50001 CREATE TABLE `ticket` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `landed` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `refFk` tinyint NOT NULL, + `addressFk` tinyint NOT NULL, + `location` tinyint NOT NULL, + `solution` tinyint NOT NULL, + `routeFk` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `agencyModeFk` tinyint NOT NULL, + `priority` tinyint NOT NULL, + `packages` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ticketObservation` +-- Table structure for table `ticketLog` +-- + +DROP TABLE IF EXISTS `ticketLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `action` set('insert','update','delete','select') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `logTicketoriginFk` (`originFk`), + KEY `logTicketuserFk` (`userFk`), + CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=290031 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ticketObservation` -- DROP TABLE IF EXISTS `ticketObservation`; /*!50001 DROP VIEW IF EXISTS `ticketObservation`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketObservation` AS SELECT - 1 AS `id`, - 1 AS `ticketFk`, - 1 AS `observationTypeFk`, - 1 AS `description`*/; +/*!50001 CREATE TABLE `ticketObservation` ( + `id` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `observationTypeFk` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47440,7 +46694,7 @@ DROP TABLE IF EXISTS `ticketPackaging`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketPackaging` ( - `id` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` int(11) NOT NULL, `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `quantity` int(10) DEFAULT '0', @@ -47449,61 +46703,88 @@ CREATE TABLE `ticketPackaging` ( PRIMARY KEY (`id`), KEY `ticketPackaging_fk1_idx` (`ticketFk`), KEY `ticketPackaging_fk2_idx` (`packagingFk`), - CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON UPDATE CASCADE, + CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=6319 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ticketPackagingStartingStock` +-- + +DROP TABLE IF EXISTS `ticketPackagingStartingStock`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketPackagingStartingStock` ( + `clientFk` int(11) NOT NULL, + `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `itemFk` int(11) NOT NULL, + `sent` int(11) DEFAULT NULL, + `returned` int(11) DEFAULT NULL, + PRIMARY KEY (`clientFk`,`packagingFk`), + KEY `ticketPackagingStartingStock_fk2_idx` (`packagingFk`), + KEY `ticketPackagingStartingStock_fk3_idx` (`itemFk`), + CONSTRAINT `ticketPackagingStartingStock_fk1` FOREIGN KEY (`clientFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketPackagingStartingStock_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketPackagingStartingStock_fk3` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticketState` +-- Temporary table structure for view `ticketState` -- DROP TABLE IF EXISTS `ticketState`; /*!50001 DROP VIEW IF EXISTS `ticketState`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketState` AS SELECT - 1 AS `ticketFk`, - 1 AS `ticket`, - 1 AS `state`, - 1 AS `productionOrder`, - 1 AS `alertLevel`, - 1 AS `code`, - 1 AS `worker`, - 1 AS `workerFk`*/; +/*!50001 CREATE TABLE `ticketState` ( + `updated` tinyint NOT NULL, + `stateFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `state` tinyint NOT NULL, + `productionOrder` tinyint NOT NULL, + `alertLevel` tinyint NOT NULL, + `code` tinyint NOT NULL, + `ticket` tinyint NOT NULL, + `worker` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ticketStateToday` +-- Temporary table structure for view `ticketStateToday` -- DROP TABLE IF EXISTS `ticketStateToday`; /*!50001 DROP VIEW IF EXISTS `ticketStateToday`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketStateToday` AS SELECT - 1 AS `ticket`, - 1 AS `state`, - 1 AS `productionOrder`, - 1 AS `alertLevel`, - 1 AS `worker`, - 1 AS `code`*/; +/*!50001 CREATE TABLE `ticketStateToday` ( + `ticket` tinyint NOT NULL, + `state` tinyint NOT NULL, + `productionOrder` tinyint NOT NULL, + `alertLevel` tinyint NOT NULL, + `worker` tinyint NOT NULL, + `code` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `ticketTracking` +-- Temporary table structure for view `ticketTracking` -- DROP TABLE IF EXISTS `ticketTracking`; /*!50001 DROP VIEW IF EXISTS `ticketTracking`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticketTracking` AS SELECT - 1 AS `id`, - 1 AS `stateFk`, - 1 AS `created`, - 1 AS `ticketFk`, - 1 AS `workerFk`*/; +/*!50001 CREATE TABLE `ticketTracking` ( + `id` tinyint NOT NULL, + `stateFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47522,43 +46803,63 @@ CREATE TABLE `ticketTrolley` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `time` +-- Temporary table structure for view `time` -- DROP TABLE IF EXISTS `time`; /*!50001 DROP VIEW IF EXISTS `time`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `time` AS SELECT - 1 AS `dated`, - 1 AS `period`, - 1 AS `month`, - 1 AS `year`, - 1 AS `day`, - 1 AS `week`*/; +/*!50001 CREATE TABLE `time` ( + `dated` tinyint NOT NULL, + `period` tinyint NOT NULL, + `month` tinyint NOT NULL, + `year` tinyint NOT NULL, + `day` tinyint NOT NULL, + `week` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `travel` +-- Table structure for table `town` +-- + +DROP TABLE IF EXISTS `town`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `town` ( + `id` int(11) NOT NULL, + `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `provinceFk` smallint(6) unsigned NOT NULL, + `geoFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `townProvinceFk_idx` (`provinceFk`), + CONSTRAINT `townProvinceFk` FOREIGN KEY (`provinceFk`) REFERENCES `vn2008`.`province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `travel` -- DROP TABLE IF EXISTS `travel`; /*!50001 DROP VIEW IF EXISTS `travel`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `travel` AS SELECT - 1 AS `id`, - 1 AS `shipped`, - 1 AS `shipmentHour`, - 1 AS `landed`, - 1 AS `landingHour`, - 1 AS `warehouseInFk`, - 1 AS `warehouseOutFk`, - 1 AS `agencyFk`, - 1 AS `ref`, - 1 AS `isDelivered`, - 1 AS `isReceived`, - 1 AS `m3`*/; +/*!50001 CREATE TABLE `travel` ( + `id` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `shipmentHour` tinyint NOT NULL, + `landed` tinyint NOT NULL, + `landingHour` tinyint NOT NULL, + `warehouseInFk` tinyint NOT NULL, + `warehouseOutFk` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `isDelivered` tinyint NOT NULL, + `isReceived` tinyint NOT NULL, + `m3` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47575,159 +46876,188 @@ CREATE TABLE `travelObservation` ( `description` text COLLATE utf8_unicode_ci NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `unary` +-- Temporary table structure for view `unary` -- DROP TABLE IF EXISTS `unary`; /*!50001 DROP VIEW IF EXISTS `unary`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `unary` AS SELECT - 1 AS `id`, - 1 AS `parent`*/; +/*!50001 CREATE TABLE `unary` ( + `id` tinyint NOT NULL, + `parent` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `unaryScan` +-- Temporary table structure for view `unaryScan` -- DROP TABLE IF EXISTS `unaryScan`; /*!50001 DROP VIEW IF EXISTS `unaryScan`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `unaryScan` AS SELECT - 1 AS `unaryFk`, - 1 AS `name`, - 1 AS `created`, - 1 AS `type`*/; +/*!50001 CREATE TABLE `unaryScan` ( + `unaryFk` tinyint NOT NULL, + `name` tinyint NOT NULL, + `created` tinyint NOT NULL, + `type` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `unaryScanLine` +-- Temporary table structure for view `unaryScanLine` -- DROP TABLE IF EXISTS `unaryScanLine`; /*!50001 DROP VIEW IF EXISTS `unaryScanLine`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `unaryScanLine` AS SELECT - 1 AS `id`, - 1 AS `code`, - 1 AS `created`, - 1 AS `unaryScanFk`*/; +/*!50001 CREATE TABLE `unaryScanLine` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `created` tinyint NOT NULL, + `unaryScanFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `unaryScanLineBuy` +-- Temporary table structure for view `unaryScanLineBuy` -- DROP TABLE IF EXISTS `unaryScanLineBuy`; /*!50001 DROP VIEW IF EXISTS `unaryScanLineBuy`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `unaryScanLineBuy` AS SELECT - 1 AS `unaryScanLineFk`, - 1 AS `itemFk`*/; +/*!50001 CREATE TABLE `unaryScanLineBuy` ( + `unaryScanLineFk` tinyint NOT NULL, + `itemFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `unaryScanLineExpedition` +-- Temporary table structure for view `unaryScanLineExpedition` -- DROP TABLE IF EXISTS `unaryScanLineExpedition`; /*!50001 DROP VIEW IF EXISTS `unaryScanLineExpedition`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `unaryScanLineExpedition` AS SELECT - 1 AS `unaryScanLineFk`, - 1 AS `expeditionFk`*/; +/*!50001 CREATE TABLE `unaryScanLineExpedition` ( + `unaryScanLineFk` tinyint NOT NULL, + `expeditionFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `user` +-- Temporary table structure for view `user` -- DROP TABLE IF EXISTS `user`; /*!50001 DROP VIEW IF EXISTS `user`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `user` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `password`, - 1 AS `role`, - 1 AS `active`, - 1 AS `recoverPass`, - 1 AS `lastPassChange`*/; +/*!50001 CREATE TABLE `user` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `password` tinyint NOT NULL, + `role` tinyint NOT NULL, + `active` tinyint NOT NULL, + `recoverPass` tinyint NOT NULL, + `lastPassChange` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `vehicle` +-- Temporary table structure for view `vehicle` -- DROP TABLE IF EXISTS `vehicle`; /*!50001 DROP VIEW IF EXISTS `vehicle`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `vehicle` AS SELECT - 1 AS `id`, - 1 AS `numberPlate`, - 1 AS `tradeMark`, - 1 AS `model`, - 1 AS `companyFk`, - 1 AS `warehouseFk`, - 1 AS `description`, - 1 AS `m3`, - 1 AS `isActive`*/; +/*!50001 CREATE TABLE `vehicle` ( + `id` tinyint NOT NULL, + `numberPlate` tinyint NOT NULL, + `tradeMark` tinyint NOT NULL, + `model` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `description` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `warehouse` +-- 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 `isInventory`, - 1 AS `hasComission`*/; +/*!50001 CREATE TABLE `warehouse` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `isInventory` tinyint NOT NULL, + `isComparative` tinyint NOT NULL, + `hasComission` tinyint NOT NULL, + `isManaged` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `warehouseAlias` +-- Temporary table structure for view `warehouseAlias` -- DROP TABLE IF EXISTS `warehouseAlias`; /*!50001 DROP VIEW IF EXISTS `warehouseAlias`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouseAlias` AS SELECT - 1 AS `id`, - 1 AS `name`*/; +/*!50001 CREATE TABLE `warehouseAlias` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `worker` +-- Table structure for table `workCenter` +-- + +DROP TABLE IF EXISTS `workCenter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workCenter` ( + `id` int(11) NOT NULL DEFAULT '0', + `name` varchar(255) DEFAULT NULL, + `payrollCenterFk` int(11) DEFAULT NULL, + `counter` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `worker` -- DROP TABLE IF EXISTS `worker`; /*!50001 DROP VIEW IF EXISTS `worker`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `worker` AS SELECT - 1 AS `id`, - 1 AS `workerCode`, - 1 AS `firstName`, - 1 AS `name`, - 1 AS `userFk`, - 1 AS `bossFk`*/; +/*!50001 CREATE TABLE `worker` ( + `id` tinyint NOT NULL, + `workerCode` tinyint NOT NULL, + `firstName` tinyint NOT NULL, + `name` tinyint NOT NULL, + `userFk` tinyint NOT NULL, + `phone` tinyint NOT NULL, + `bossFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47746,22 +47076,45 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_2` (`document`), CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `vn2008`.`Trabajadores` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `vn2008`.`gestdoc` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3270 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `workerTeam` +-- Table structure for table `workerLog` +-- + +DROP TABLE IF EXISTS `workerLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `workerFk_idx` (`originFk`), + KEY `userFk_idx` (`userFk`), + CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=1258 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 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 `user`, - 1 AS `id`, - 1 AS `Id_Trabajador`*/; +/*!50001 CREATE TABLE `workerTeam` ( + `team` tinyint NOT NULL, + `user` tinyint NOT NULL, + `id` tinyint NOT NULL, + `Id_Trabajador` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -47778,7 +47131,7 @@ CREATE TABLE `workerTeam_kk` ( PRIMARY KEY (`id`), KEY `user_team_idx` (`user`), CONSTRAINT `user_team` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=77 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -47796,7 +47149,7 @@ CREATE TABLE `workingHours` ( PRIMARY KEY (`id`), KEY `user_working_hour_idx` (`userId`), CONSTRAINT `user_working_hour` FOREIGN KEY (`userId`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; +) ENGINE=InnoDB AUTO_INCREMENT=14972 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -47835,6 +47188,8 @@ CREATE TABLE `zone` ( `warehouseFk` int(11) NOT NULL, `agencyFk` int(11) NOT NULL, `travelingDays` int(11) NOT NULL DEFAULT '1', + `price` double NOT NULL DEFAULT '0', + `bonus` double NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`name`), UNIQUE KEY `name_UNIQUE` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -47863,18 +47218,136 @@ DROP TABLE IF EXISTS `zoneGeo`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneGeo` ( - `zoneFk` varchar(45) CHARACTER SET utf8 NOT NULL, + `zoneFk` int(11) NOT NULL, `geoFk` int(11) NOT NULL, `isIncluded` tinyint(1) DEFAULT NULL, - PRIMARY KEY (`zoneFk`,`geoFk`) + PRIMARY KEY (`zoneFk`,`geoFk`), + KEY `geoFk_idx` (`geoFk`), + CONSTRAINT `geoFk` FOREIGN KEY (`geoFk`) REFERENCES `zoneNest` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `zoneGeoFk` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `zoneNest` +-- + +DROP TABLE IF EXISTS `zoneNest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneNest` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `lft` int(11) DEFAULT NULL, + `rgt` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=20944 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneNestTree` +-- + +DROP TABLE IF EXISTS `zoneNestTree`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneNestTree` ( + `id` int(11) NOT NULL DEFAULT '0', + `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `lft` int(11) DEFAULT NULL, + `rgt` int(11) DEFAULT NULL, + `depth` bigint(22) NOT NULL DEFAULT '0', + `sons` decimal(10,0) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'vn' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `ticketClosure` */; +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 = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Realiza el cierre de todos los almacenes del dia actual' DO CALL ticketClosureMultiWarehouse(DATE_ADD(CURDATE(), INTERVAL -1 DAY)) */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + -- -- Dumping routines for database 'vn' -- +/*!50003 DROP FUNCTION IF EXISTS `addressTaxArea` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `addressTaxArea`(vAddresId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8 + DETERMINISTIC +BEGIN +/** + * Devuelve el area de un Consignatario, + * intracomunitario, extracomunitario, nacional o recargo de equivalencia. + * Asumimos que no tenemos ninguna empresa + * + * @param vAddresId Id del Consignatario + * @param vCompanyId Compañia desde la que se factura + * @return Código de area + */ + DECLARE vTaxArea VARCHAR(25); + DECLARE vClientIsUeeMember INT; + DECLARE vSupplierIsUeeMember INT; + DECLARE vSpainCountryCode INT DEFAULT 1; + DECLARE vSupplierCountry INT; + DECLARE vClientCountry INT; + DECLARE vIsEqualizated BOOLEAN; + DECLARE vIsVies BOOLEAN; + + SELECT cClient.isUeeMember, c.countryFk, a.isEqualizated, cSupplier.isUeeMember, s.countryFk, c.isVies + INTO vClientIsUeeMember, vClientCountry, vIsEqualizated, vSupplierIsUeeMember, vSupplierCountry, vIsVies + FROM address a + JOIN `client` c ON c.id = a.clientFk + JOIN country cClient ON cClient.id = c.countryFk + JOIN supplier s ON s.id = vCompanyId + JOIN country cSupplier ON cSupplier.id = s.countryFk + WHERE a.id = vAddresId; + + CASE + WHEN (NOT vClientIsUeeMember OR NOT vSupplierIsUeeMember) AND vSupplierCountry != vClientCountry THEN + SET vTaxArea = 'WORLD'; + WHEN vClientIsUeeMember AND vSupplierIsUeeMember AND vClientCountry != vSupplierCountry AND vIsVies THEN + SET vTaxArea = 'CEE'; + WHEN vIsEqualizated AND vClientCountry = vSpainCountryCode THEN + SET vTaxArea = 'EQU'; + ELSE + SET vTaxArea = 'NATIONAL'; + END CASE; + + RETURN vTaxArea; +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 DROP FUNCTION IF EXISTS `agencyIsAvailable` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -47903,16 +47376,16 @@ BEGIN DECLARE vProvince INT; DECLARE isAvailable BOOL; - SELECT province INTO vProvince + SELECT provinceFk INTO vProvince FROM address WHERE id = vAddress; SELECT COUNT(*) > 0 INTO isAvailable FROM agencyHour h JOIN agencyMode a - ON a.agency = h.agency - WHERE (h.province = vProvince - OR h.province IS NULL) + ON a.agencyFk = h.agencyFk + WHERE (h.provinceFk = vProvince + OR h.provinceFk IS NULL) AND (h.weekDay = vWday OR h.weekDay IS NULL) AND (h.substractDay < vMaxDays @@ -47926,7 +47399,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP FUNCTION IF EXISTS `clientGetDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47940,9 +47412,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `clientGetDebt`(vClient INT, vDate DATE) RETURNS decimal(10,2) BEGIN /** - * Devuelve el saldo del cliente. + * Devuelve el saldo de un cliente. * - * @param vClient Id del cliente + * @param vClient Identificador del cliente * @param vDate Fecha hasta la que tener en cuenta * @return Saldo del cliente */ @@ -47952,27 +47424,27 @@ BEGIN SET vDate = IFNULL(vDate, CURDATE()); - SET vDateIni = TIMESTAMPADD(MONTH,-2,CURDATE()); + SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE()); SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS vn2008.ticket_tmp; - CREATE TEMPORARY TABLE vn2008.ticket_tmp - (INDEX (ticket_id)) + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (ticketFk)) ENGINE = MEMORY - SELECT id ticket_id + SELECT id ticketFk FROM ticket - WHERE clientfK = vClient + WHERE clientFk = vClient AND refFk IS NULL AND shipped BETWEEN vDateIni AND vDateEnd; - CALL vn2008.ticket_total (); + CALL vn.ticketGetTotal; SELECT IFNULL(SUM(t.amount), 0) INTO vDebt FROM ( SELECT SUM(total) amount - FROM vn2008.ticket_total + FROM tmp.ticketTotal UNION ALL - SELECT SUM(Entregado) + SELECT SUM(Entregado) FROM vn2008.Recibos WHERE Id_Cliente = vClient AND Fechacobro > vDateEnd @@ -47982,88 +47454,16 @@ BEGIN WHERE customer_id = vClient UNION ALL SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction - WHERE customer_id = vClient - AND receipt_id IS NULL + FROM hedera.tpvTransaction + WHERE clientFk = vClient + AND receiptFk IS NULL AND `status` = 'ok' ) t; DROP TEMPORARY TABLE - vn2008.ticket_tmp, - vn2008.ticket_total; - - RETURN vDebt; -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 DROP FUNCTION IF EXISTS `clientGetDebtKK` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `clientGetDebtKK`(vClient INT, vDate DATE) RETURNS decimal(10,2) -BEGIN -/** - * Devuelve el saldo del cliente. - * - * @param vClient Id del cliente - * @param vDate Fecha hasta la que tener en cuenta - * @return Saldo del cliente - */ - DECLARE vDateEnd DATETIME; - DECLARE vDateIni DATETIME; - DECLARE vDebt DECIMAL(10,2); + tmp.ticket, + tmp.ticketTotal; - SET vDate = IFNULL(vDate, CURDATE()); - - SET vDateIni = TIMESTAMPADD(MONTH,-2,CURDATE()); - SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS vn2008.ticket_tmp; - CREATE TEMPORARY TABLE vn2008.ticket_tmp - (INDEX (ticket_id)) - ENGINE = MEMORY - SELECT id ticket_id - FROM ticket - WHERE `client` = vClient - AND refFk IS NULL - AND shipment BETWEEN vDateIni AND vDateEnd; - - CALL vn2008.ticket_total (); - - SELECT IFNULL(SUM(t.amount), 0) INTO vDebt - FROM ( - SELECT SUM(total) amount - FROM vn2008.ticket_total - UNION ALL - SELECT SUM(Entregado) - FROM vn2008.Recibos - WHERE Id_Cliente = vClient - AND Fechacobro > vDateEnd - UNION ALL - SELECT SUM(amount) - FROM bi.customer_risk r - WHERE customer_id = vClient - UNION ALL - SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction - WHERE customer_id = vClient - AND receipt_id IS NULL - AND `status` = 'ok' - ) t; - - DROP TEMPORARY TABLE - vn2008.ticket_tmp, - vn2008.ticket_total; - RETURN vDebt; END ;; DELIMITER ; @@ -48154,7 +47554,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `clientTaxArea`(vClientFk INT, vCompanyFk INT) RETURNS varchar(25) CHARSET utf8 +CREATE DEFINER=`root`@`%` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8 BEGIN /** * Devuelve el area de un cliente, @@ -48164,24 +47564,24 @@ BEGIN * @param vCompanyFk Compañia desde la que se factura * @return Código de area */ - DECLARE vTaxArea VARCHAR(25); + DECLARE vTaxArea VARCHAR(25); DECLARE vCee INT; - SELECT ct.Cee INTO vCee - FROM `client` c - JOIN country ct ON ct.id = c.countryFk - JOIN supplier s ON s.id = vCompanyFk - WHERE - c.id = vClientFk - AND c.vies - AND c.countryFk != s.countryFk; - - IF vCee < 2 THEN - SET vTaxArea = 'CEE'; + SELECT ct.Cee INTO vCee + FROM `client` c + JOIN country ct ON ct.id = c.countryFk + JOIN supplier s ON s.id = vCompanyId + WHERE + c.id = vClientId + AND c.isVies + AND c.countryFk != s.countryFk; + + IF vCee < 2 THEN + SET vTaxArea = 'CEE'; ELSEIF vCee = 2 THEN - SET vTaxArea = 'WORLD'; - ELSE - SET vTaxArea = 'NATIONAL'; + SET vTaxArea = 'WORLD'; + ELSE + SET vTaxArea = 'NATIONAL'; END IF; RETURN vTaxArea; @@ -48295,7 +47695,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP FUNCTION IF EXISTS `getShipmentHour` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -48309,7 +47708,7 @@ CREATE DEFINER=`root`@`%` FUNCTION `getShipmentHour`(vTicket INT) RETURNS int(11 BEGIN DECLARE vShipmentHour INT; - SELECT HOUR(shipment) INTO vShipmentHour + SELECT HOUR(shipped) INTO vShipmentHour FROM ticket WHERE id = vTicket; @@ -48319,13 +47718,13 @@ BEGIN CREATE TEMPORARY TABLE tmp.production_buffer ENGINE = MEMORY SELECT am.agency as agency_id - , t.warehouse as warehouse_id + , t.warehouseFk as warehouse_id , a.province as province_id , 0 as Hora , 0 as Departure FROM ticket t - JOIN agencyMode am on am.id = t.agencyMode - JOIN address a on a.id = t.address + JOIN agencyMode am on am.id = t.agencyModeFk + JOIN address a on a.id = t.addressFk WHERE t.id = vTicket; CALL vn2008.production_buffer_set_priority; @@ -48341,7 +47740,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP FUNCTION IF EXISTS `getSpecialPrice` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48373,13 +47771,12 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `getTicketToPrepare` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; @@ -48392,6 +47789,7 @@ BEGIN * @param vWarehouse Id del almacén * @return Id del ticket **/ + DECLARE vToday DATETIME DEFAULT CURDATE(); DECLARE vYesterday DATETIME; DECLARE vTodayvMidniight DATETIME DEFAULT midnight(vToday); @@ -48403,29 +47801,30 @@ BEGIN CREATE TEMPORARY TABLE tmp.workerComercial ENGINE = MEMORY SELECT worker FROM `grant` g - JOIN grantGroup gg ON g.group = gg.id + JOIN grantGroup gg ON g.`group` = gg.id WHERE gg.description = 'Comerciales' - AND worker != 2; -- PAKO - + AND worker != 2; -- PAKO numero + DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; CREATE TEMPORARY TABLE tmp.production_buffer ENGINE = MEMORY SELECT t.id as ticket , am.agency as agency_id - , t.warehouse as warehouse_id + , t.warehouseFk as warehouse_id , a.province as province_id - , Hour(t.shipment) as Hora - , Hour(t.shipment) as Departure + , Hour(t.shipped) as Hora + , Hour(t.shipped) as Departure + , Minute(t.shipped) as Minuto , tls.code - , IFNULL(t.loadingOrder,0) loadingOrder + , IFNULL(t.priority,0) loadingOrder FROM ticket t JOIN ticketState tls on t.id = tls.ticket - JOIN agencyMode am on am.id = t.agencyMode - JOIN address a on a.id = t.address + JOIN agencyMode am on am.id = t.agencyModeFk + JOIN address a on a.id = t.addressFk LEFT JOIN tmp.workerComercial wc ON wc.worker = vWorker - WHERE t.shipment BETWEEN vYesterday AND vTodayvMidniight - AND t.warehouse = vWarehouse + WHERE t.shipped BETWEEN vYesterday AND vTodayvMidniight + AND t.warehouseFk = vWarehouse AND ( (tls.code = 'PRINTED' AND wc.worker IS NULL) @@ -48440,17 +47839,17 @@ BEGIN SELECT ticket INTO vTicket FROM tmp.production_buffer - ORDER BY (code = 'PICKER_DESIGNED') DESC , Hora, loadingOrder + ORDER BY (code = 'PICKER_DESIGNED') DESC , Hora, Minuto, loadingOrder LIMIT 1; RETURN vTicket; + 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 */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP FUNCTION IF EXISTS `getTicketTrolleyLabelCount` */; ALTER DATABASE `vn` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -48724,58 +48123,97 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `invoiceSerial`(vClientFk INT, vCompanyFk INT, vType CHAR(1)) RETURNS char(1) CHARSET utf8 BEGIN -/** - * Obtiene la serie de de una factura - * dependiendo del area del cliente. - * - * @param vClientFk Id del cliente - * @param vCompanyFk Id de la empresa - * @param vType Tipo de factura ["R", "M", "G"] - * @return Serie de la factura - */ + /** + * Obtiene la serie de de una factura + * dependiendo del area del cliente. + * + * @param vClientFk Id del cliente + * @param vCompanyFk Id de la empresa + * @param vType Tipo de factura ["R", "M", "G"] + * @return Serie de la factura + */ DECLARE vArea VARCHAR(25); DECLARE vSerie CHAR(1); - + + IF (SELECT hasInvoiceSimplified FROM client WHERE id = vClientFk) THEN + RETURN 'S'; + END IF; + SELECT clientTaxArea(vClientFk, vCompanyFk) INTO vArea; - - -- Factura rápida - IF vType = 'R' THEN + -- Factura rápida + IF vType = 'R' THEN SELECT CASE vArea WHEN 'CEE' - THEN 'H' + THEN 'H' WHEN 'WORLD' - THEN 'E' + THEN 'E' WHEN 'NATIONAL' - THEN 'T' - END + THEN 'T' + END INTO vSerie; - -- Factura multiple - ELSEIF vType = 'M' THEN + -- Factura multiple + ELSEIF vType = 'M' THEN SELECT CASE vArea WHEN 'CEE' - THEN 'H' + THEN 'H' WHEN 'WORLD' - THEN 'E' + THEN 'E' WHEN 'NATIONAL' - THEN 'M' - END + THEN 'M' + END INTO vSerie; -- Factura global ELSEIF vType = 'G' THEN SELECT CASE vArea WHEN 'CEE' - THEN 'V' + THEN 'V' WHEN 'WORLD' - THEN 'X' + THEN 'X' WHEN 'NATIONAL' - THEN 'A' - END + THEN 'A' + END INTO vSerie; - END IF; -RETURN vSerie; + END IF; + RETURN vSerie; +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 DROP FUNCTION IF EXISTS `isPalletHomogeneus` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `isPalletHomogeneus`(vExpedition INT) RETURNS tinyint(1) +BEGIN + DECLARE vScanId INT; + DECLARE vDistinctRoutesInThePallet INT; + + SELECT scan_id INTO vScanId + FROM vn2008.scan_line + WHERE code = vExpedition; + + SELECT COUNT(*) INTO vDistinctRoutesInThePallet + 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 + WHERE sl.scan_id = vScanId + AND t.Id_Ruta + ) t1; + + RETURN vDistinctRoutesInThePallet = 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48910,7 +48348,7 @@ ALTER DATABASE `vn` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `midnight`(vDate DATE) RETURNS datetime +CREATE DEFINER=`root`@`%` FUNCTION `MIDNIGHT`(vDate DATE) RETURNS datetime DETERMINISTIC BEGIN RETURN TIMESTAMP(vDate,'23:59:59'); @@ -49010,6 +48448,91 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `ticketGetTotal` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `ticketGetTotal`(vTicketId INT) RETURNS decimal(10,2) + READS SQL DATA + DETERMINISTIC +BEGIN +/** + * Calcula el total con IVA de un ticket. + * + * @param vTicketId Identificador del ticket + * @return Total del ticket + */ + DECLARE vTotal DECIMAL(10,2); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketId ticketFk; + + CALL ticketGetTotal; + + SELECT total INTO vTotal FROM tmp.ticketTotal; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal; + + RETURN vTotal; + +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 DROP FUNCTION IF EXISTS `ticketGetTotalkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `ticketGetTotalkk`(vTicketId INT) RETURNS decimal(10,2) + READS SQL DATA + DETERMINISTIC +BEGIN +/** + * Calcula el total con IVA de un ticket. + * + * @param vTicketId Identificador del ticket + * @return Total del ticket + */ + DECLARE vTotal DECIMAL(10,2); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketId ticketFk; + + CALL ticketGetTotal; + + SELECT total INTO vTotal FROM tmp.ticketTotal; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal; + + RETURN vTotal; +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 DROP FUNCTION IF EXISTS `ticketPositionInPath` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49262,7 +48785,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `agencyListAvailable` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -49280,25 +48802,25 @@ BEGIN * * @param vDate Fecha de recepción de mercancía * @param vAddress Id consignatario, %NULL para recogida - * @table travel_tree Lista de almacenes disponibles + * @return travel_tree Lista de almacenes disponibles */ DECLARE vMaxDays INT DEFAULT DATEDIFF(vDate, CURDATE()); DECLARE vWday TINYINT DEFAULT WEEKDAY(vDate); DECLARE vHour TINYINT DEFAULT HOUR(NOW()); DECLARE vProvince INT; - SELECT province INTO vProvince + SELECT provinceFk INTO vProvince FROM address WHERE id = vAddress; DROP TEMPORARY TABLE IF EXISTS tmp.agencyAvailable; CREATE TEMPORARY TABLE tmp.agencyAvailable - (INDEX (agency)) + (INDEX (agencyFk)) ENGINE = MEMORY - SELECT agency, warehouse + SELECT agencyFk, warehouseFk FROM agencyHour h - WHERE (province = vProvince - OR province IS NULL) + WHERE (provinceFk = vProvince + OR provinceFk IS NULL) AND (weekDay = vWday OR weekDay IS NULL) AND (substractDay < vMaxDays @@ -49309,48 +48831,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `agencyListForMethod` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `agencyListForMethod`( - vDate DATE, vAddress INT, vMethod VARCHAR(255)) -BEGIN -/** - * Devuelve la lista de agencias disponibles para una forma - * de envío. - * - * @param vDate Fecha de recepción de mercancía - * @param vAddress Id consignatario, %NULL para recogida - * @param vMethod Código de la forma de envío - * @select Lista de agencias disponibles - */ - CALL agencyListAvailable (vDate, vAddress); - - SELECT DISTINCT m.id, m.description - FROM tmp.agencyAvailable a - JOIN agencyMode m - ON m.agency = a.agency - JOIN deliveryMethod d - ON d.id = m.deliveryMethod - WHERE d.code = vMethod COLLATE 'utf8_unicode_ci'; - - DROP TEMPORARY TABLE tmp.agencyAvailable; -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 */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49368,9 +48848,13 @@ BEGIN SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); + DELETE FROM vn.dailyTaskLog WHERE created < vDateShort; + INSERT INTO vn.dailyTaskLog(state) VALUES('clean START'); DELETE FROM vn.message WHERE sendDate < vDateShort; + DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; + DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; INSERT INTO vn.dailyTaskLog(state) VALUES('clean END'); END ;; @@ -49455,7 +48939,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `createExternalWorker` */; +/*!50003 DROP PROCEDURE IF EXISTS `createExternalWorkerkk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -49465,7 +48949,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `createExternalWorker`( +CREATE DEFINER=`root`@`%` PROCEDURE `createExternalWorkerkk`( vFirstName VARCHAR(50), vSurname1 VARCHAR(50), vSurname2 VARCHAR(50), @@ -49477,6 +48961,7 @@ BEGIN DECLARE vUserId INT; DECLARE vWorkerPako INT DEFAULT 2; + DECLARE vSurnames VARCHAR(100); INSERT INTO account.user(name,password,role) SELECT vUser,MD5(vPassword),1; @@ -49486,9 +48971,15 @@ BEGIN INSERT INTO vn.worker(firstName,name,bossFk,workerCode,user_id) SELECT vFirstName,CONCAT(vSurname1,' ',vSurname2),2,vWorkerCode,vUser; */ + + IF vSurname2 IS NULL THEN + SET vSurnames = vSurname1; + ELSE + SET vSurnames = CONCAT(vSurname1, ' ', vSurname2); + END IF; - INSERT INTO vn2008.Trabajadores(Nombre,Apellidos,boss,CodigoTrabajador,user_id) - SELECT vFirstName,CONCAT(vSurname1,' ',vSurname2),vWorkerPako,vWorkerCode,vUserId; + INSERT INTO vn2008.Trabajadores(Nombre, Apellidos, boss, CodigoTrabajador, user_id) + SELECT vFirstName, vSurnames, vWorkerPako, vWorkerCode, vUserId; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49737,87 +49228,85 @@ BEGIN /** * Calcula el riesgo para los clientes activos de la tabla temporal tmp.client_list * + * @table tmp.client_list * @param vDate Fecha maxima de los registros - * @tmp.risk - * - * @return table tmp.risk - **/ + * @treturn tmp.risk + */ + DECLARE vDateIni DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 5, CURDATE()); + DECLARE vDateEnd DATETIME; + DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; - DECLARE vDateIni DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 5, CURDATE()); - DECLARE vDateEnd DATETIME; - DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; - - SET vDateEnd = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS tmp.clientList2; - CREATE TEMPORARY TABLE tmp.clientList2 - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * - FROM tmp.client_list; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientList3; - CREATE TEMPORARY TABLE tmp.clientList3 - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * - FROM tmp.client_list; + SET vDateEnd = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); - DROP TEMPORARY TABLE IF EXISTS vn2008.ticket_tmp; - CREATE TEMPORARY TABLE vn2008.ticket_tmp - (INDEX (ticket_id)) - ENGINE = MEMORY - SELECT id ticket_id, cl.Id_Cliente - FROM ticket t - JOIN tmp.clientList2 cl ON t.clientFk = cl.Id_Cliente - WHERE refFk IS NULL - AND shipped BETWEEN vDateIni AND vDateEnd; - - CALL vn2008.ticket_total (); + DROP TEMPORARY TABLE IF EXISTS tmp.clientList2; + CREATE TEMPORARY TABLE tmp.clientList2 + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT * + FROM tmp.client_list; - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - CREATE TEMPORARY TABLE tmp.risk - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT Id_Cliente, SUM(amount) risk - FROM vn2008.Clientes c - JOIN ( - SELECT customer_id, SUM(amount) amount - FROM bi.customer_risk cr - JOIN tmp.client_list on tmp.client_list.Id_Cliente = cr.customer_id - GROUP BY customer_id - UNION ALL - SELECT Id_Cliente, SUM(Entregado) - FROM vn2008.Recibos - JOIN tmp.clientList2 using(Id_Cliente) - WHERE Fechacobro > vDateIni - GROUP BY Id_Cliente - UNION ALL - SELECT t.Id_Cliente, total - FROM vn2008.ticket_total tt - JOIN vn2008.ticket_tmp t ON tt.ticket_id = t.ticket_id - UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - JOIN tmp.clientList3 on Id_Cliente = customer_id - WHERE t.receipt_id IS NULL - AND t.status = 'ok' - GROUP BY t.customer_id - ) t ON c.Id_Cliente = t.customer_id - WHERE c.activo != FALSE - GROUP BY c.Id_Cliente; - - DROP TEMPORARY TABLE vn2008.ticket_tmp; - DROP TEMPORARY TABLE tmp.clientList2; - DROP TEMPORARY TABLE tmp.clientList3; - DROP TEMPORARY TABLE vn2008.ticket_total; + DROP TEMPORARY TABLE IF EXISTS tmp.clientList3; + CREATE TEMPORARY TABLE tmp.clientList3 + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT * + FROM tmp.client_list; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk, cl.Id_Cliente + FROM ticket t + JOIN tmp.clientList2 cl ON t.clientFk = cl.Id_Cliente + WHERE refFk IS NULL + AND shipped BETWEEN vDateIni AND vDateEnd; + + CALL vn.ticketGetTotal(); + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + CREATE TEMPORARY TABLE tmp.risk + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT Id_Cliente, SUM(amount) risk + FROM vn2008.Clientes c + JOIN ( + SELECT customer_id, SUM(amount) amount + FROM bi.customer_risk cr + JOIN tmp.client_list on tmp.client_list.Id_Cliente = cr.customer_id + GROUP BY customer_id + UNION ALL + SELECT Id_Cliente, SUM(Entregado) + FROM vn2008.Recibos + JOIN tmp.clientList2 using(Id_Cliente) + WHERE Fechacobro > vDateIni + GROUP BY Id_Cliente + UNION ALL + SELECT t.Id_Cliente, total + FROM tmp.ticketTotal tt + JOIN tmp.ticket t ON t.ticketFk = tt.ticketFk + UNION ALL + SELECT t.clientFk customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + JOIN tmp.clientList3 l ON l.Id_Cliente = t.clientFk + WHERE t.receiptFk IS NULL + AND t.status = 'ok' + GROUP BY t.clientFk + ) t ON c.Id_Cliente = t.customer_id + WHERE c.activo != FALSE + GROUP BY c.Id_Cliente; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.clientList2, + tmp.clientList3; 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 DROP PROCEDURE IF EXISTS `getDebtkk` */; +/*!50003 DROP PROCEDURE IF EXISTS `getDebtKk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -49827,36 +49316,35 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `getDebtkk`(vDate DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `getDebtKk`(vDate DATE) BEGIN /** * Calcula el riesgo para los clientes activos de la tabla temporal tmp.client_list * + * @deprecated usar vn.clientGetDebt + * @table tmp.client_list * @param vDate Fecha maxima de los registros - * @tmp.risk - * - * @return table tmp.risk - **/ - - DECLARE vDateIni DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 5, CURDATE()); + * @treturn tmp.risk + */ + DECLARE vDateIni DATETIME DEFAULT TIMESTAMPADD(DAY, - DAYOFMONTH(CURDATE()) - 5, CURDATE()); DECLARE vDateEnd DATETIME; - DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; - - SET vDateEnd = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS tmp.clientList2; - CREATE TEMPORARY TABLE tmp.clientList2 - (PRIMARY KEY (Id_Cliente)) + DECLARE MAX_RISK_ALLOWED INT DEFAULT 200; + + SET vDateEnd = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); + + DROP TEMPORARY TABLE IF EXISTS tmp.clientList2; + CREATE TEMPORARY TABLE tmp.clientList2 + (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY SELECT * - FROM tmp.client_list; - + FROM tmp.client_list; + DROP TEMPORARY TABLE IF EXISTS tmp.clientList3; - CREATE TEMPORARY TABLE tmp.clientList3 - (PRIMARY KEY (Id_Cliente)) + CREATE TEMPORARY TABLE tmp.clientList3 + (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY SELECT * - FROM tmp.client_list; + FROM tmp.client_list; DROP TEMPORARY TABLE IF EXISTS vn2008.ticket_tmp; CREATE TEMPORARY TABLE vn2008.ticket_tmp @@ -49864,11 +49352,11 @@ BEGIN ENGINE = MEMORY SELECT id ticket_id, cl.Id_Cliente FROM ticket t - JOIN tmp.clientList2 cl ON t.client = cl.Id_Cliente + JOIN tmp.clientList2 cl ON t.clientFk = cl.Id_Cliente WHERE refFk IS NULL - AND shipment BETWEEN vDateIni AND vDateEnd; - - CALL vn2008.ticket_total (); + AND shipped BETWEEN vDateIni AND vDateEnd; + + CALL vn2008.ticket_total; DROP TEMPORARY TABLE IF EXISTS tmp.risk; CREATE TEMPORARY TABLE tmp.risk @@ -49876,36 +49364,37 @@ BEGIN ENGINE = MEMORY SELECT Id_Cliente, SUM(amount) risk FROM vn2008.Clientes c - JOIN ( - SELECT customer_id, SUM(amount) amount - FROM bi.customer_risk cr - JOIN tmp.client_list on tmp.client_list.Id_Cliente = cr.customer_id - GROUP BY customer_id - UNION ALL - SELECT Id_Cliente, SUM(Entregado) - FROM vn2008.Recibos - JOIN tmp.clientList2 using(Id_Cliente) - WHERE Fechacobro > vDateIni - GROUP BY Id_Cliente - UNION ALL - SELECT t.Id_Cliente, total - FROM vn2008.ticket_total tt + JOIN ( + SELECT customer_id, SUM(amount) amount + FROM bi.customer_risk cr + JOIN tmp.client_list on tmp.client_list.Id_Cliente = cr.customer_id + GROUP BY customer_id + UNION ALL + SELECT Id_Cliente, SUM(Entregado) + FROM vn2008.Recibos + JOIN tmp.clientList2 using(Id_Cliente) + WHERE Fechacobro > vDateIni + GROUP BY Id_Cliente + UNION ALL + SELECT t.Id_Cliente, total + FROM vn2008.ticket_total tt JOIN vn2008.ticket_tmp t ON tt.ticket_id = t.ticket_id - UNION ALL - SELECT t.customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpv_transaction t - JOIN tmp.clientList3 on Id_Cliente = customer_id - WHERE t.receipt_id IS NULL + UNION ALL + SELECT t.clientFk customer_id, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + JOIN tmp.clientList3 l ON l.Id_Cliente = t.clientFk + WHERE t.receiptFk IS NULL AND t.status = 'ok' - GROUP BY t.customer_id - ) t ON c.Id_Cliente = t.customer_id + GROUP BY t.clientFk + ) t ON c.Id_Cliente = t.customer_id WHERE c.activo != FALSE GROUP BY c.Id_Cliente; - - DROP TEMPORARY TABLE vn2008.ticket_tmp; - DROP TEMPORARY TABLE tmp.clientList2; - DROP TEMPORARY TABLE tmp.clientList3; - DROP TEMPORARY TABLE vn2008.ticket_total; + + DROP TEMPORARY TABLE + vn2008.ticket_tmp, + vn2008.ticket_total, + tmp.clientList2, + tmp.clientList3; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49949,8 +49438,7 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceCorrectedSale` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceCorrectedSalekk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -49960,7 +49448,7 @@ ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `invoiceCorrectedSale`(vInvoiceOut INT) +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceCorrectedSalekk`(vInvoiceOut INT) BEGIN /* Devuelve los registros de la factura en cuestion, para preparar la factura rectificativa @@ -49988,7 +49476,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `invoiceExpenceMake` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50128,7 +49615,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInBooking` */; +/*!50003 DROP PROCEDURE IF EXISTS `invoiceInBookingCommon` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -50138,8 +49625,336 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBooking`(vInvoiceInId INT) +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingCommon`(vInvoiceInId INT, OUT vSerialNumber INT) BEGIN + + DROP TEMPORARY TABLE IF EXISTS newInvoiceIn; + + CREATE TEMPORARY TABLE newInvoiceIn + SELECT + i.*, + YEAR(i.booked) datedYear, + -- CONCAT('s/fra',RIGHT(i.supplierRef,8)) concept, + CONCAT('s/fra',RIGHT(i.supplierRef,8),':',LEFT(s.name, 10)) conceptWithSupplier, + (cc.id = c.id) isSameCountry, + cit.id invoicesCount + FROM invoiceIn i + JOIN cplusInvoiceType472 cit ON cit.id = i.cplusInvoiceType472Fk + JOIN supplier s ON s.id = i.supplierFk + JOIN country c ON c.id = s.countryFk + JOIN supplier sc ON sc.id = i.companyFk + JOIN country cc ON cc.id = sc.countryFk + WHERE i.id = vInvoiceInId; + + DROP TEMPORARY TABLE IF EXISTS newSupplier; + CREATE TEMPORARY TABLE newSupplier + SELECT + s.*, + REPLACE(s.account,' ','') supplierAccount, + IF(c.CEE < 2, TRUE, FALSE) isUeeMember + FROM supplier s + JOIN newInvoiceIn n + JOIN country c ON c.id = s.countryFk + WHERE s.id = n.supplierFk; + + IF (SELECT isActive FROM newSupplier) = 0 THEN + CALL util.throw('INACTIVE_PROVIDER'); + END IF; + + SELECT IFNULL(MAX(i.serialNumber) + 1,1) + INTO vSerialNumber + FROM invoiceIn i + JOIN newInvoiceIn n + WHERE i.serial LIKE n.serial + AND YEAR(i.booked) = n.datedYear + AND i.companyFk = n.companyFk + GROUP BY i.companyFk; + +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 DROP PROCEDURE IF EXISTS `invoiceInBookingExtra` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingExtra`(vInvoiceInId INT) +BEGIN + DECLARE vBookNumber,vSerialNumber INT; + + CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); + + SELECT MAX(ASIEN) + 1 + INTO vBookNumber + FROM vn2008.XDiario; + + -- Actualizacion de la fecha de contabilizado y de operacion de las importaciones + UPDATE invoiceInEntry iie + JOIN invoiceIn ii ON ii.id = iie.invoiceInFk + JOIN invoiceInAwb iia ON iia.invoiceInFk = iie.invoiceInAwbFk + JOIN awb a ON a.id = iia.awbFk + SET ii.isBooked = TRUE, + ii.booked = IFNULL(ii.booked,a.booked), + ii.operated = IFNULL(ii.operated,a.operated), + ii.issued = IFNULL(ii.issued,a.issued), + ii.bookEntried = IFNULL(ii.bookEntried,a.bookEntried) + WHERE iie.invoiceInAwbFk = vInvoiceInId; + + -- Extracomunitarias gasto contra proveedor/acreedor + INSERT INTO vn2008.XDiario ( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + CONCEPTO, + CAMBIO, + DEBEME, + NFACTICK, + empresa_id + ) + SELECT + vBookNumber ASIEN, + IFNULL(a.bookEntried, n.bookEntried) FECHA, + iit.expenceFk SUBCTA, + s.account CONTRA, + ROUND(SUM(iit.taxableBase) * (iie.percentage / 100),2) EURODEBE, + CONCAT('COMPRA s/fra ',i.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, + SUM(iit.taxableBase) / SUM(iit.foreignValue) CAMBIO, + ROUND(SUM(iit.foreignValue) * (iie.percentage / 100),2) DEBEME, + n.invoicesCount NFACTICK, + n.companyFk empresa_id + FROM newInvoiceIn n + JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = n.id + JOIN invoiceInTax iit ON iit.invoiceInFk = iie.invoiceInFk + JOIN invoiceIn i ON i.id = iit.invoiceInFk + JOIN supplier s ON s.id = i.supplierFk + LEFT JOIN invoiceInAwb iia ON iia.invoiceInFk = n.id + LEFT JOIN awb a ON a.id = iia.awbFk + WHERE iie.percentage + GROUP BY i.id; + + -- Extracomunitarias proveedor contra gasto + INSERT INTO vn2008.XDiario ( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EUROHABER, + CONCEPTO, + CAMBIO, + HABERME, + NFACTICK, + empresa_id + ) + SELECT + vBookNumber ASIEN, + IFNULL(a.bookEntried, n.bookEntried) FECHA, + s.account SUBCTA, + iit.expenceFk CONTRA, + ROUND(SUM(iit.taxableBase) * (iie.percentage / 100),2) EUROHABER, + CONCAT('COMPRA s/fra ',i.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, + SUM(iit.taxableBase) / SUM(iit.foreignValue) CAMBIO, + SUM(iit.foreignValue) HABERME, + n.invoicesCount NFACTICK, + n.companyFk empresa_id + FROM newInvoiceIn n + JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = n.id + JOIN invoiceInTax iit ON iit.invoiceInFk = iie.invoiceInFk + JOIN invoiceIn i ON i.id = iit.invoiceInFk + JOIN supplier s ON s.id = i.supplierFk + LEFT JOIN invoiceInAwb iia ON iia.invoiceInFk = n.id + LEFT JOIN awb a ON a.id = iia.awbFk + WHERE iie.percentage + GROUP BY i.id; + + -- Iva Importacion pendiente + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + CONCEPTO, + EUROHABER,-- EURODEBE + SERIE, + empresa_id) + + SELECT + vBookNumber, + a.bookEntried, + '4700000999', + n.conceptWithSupplier, + ROUND(SUM(iii.amount * (tc.rate/100)),2) eurohaber, + n.serial, + n.companyFk + FROM newInvoiceIn n + JOIN invoiceInIntrastat iii ON n.id = iii.invoiceInFk + JOIN intrastat ii ON ii.id = iii.intrastatFk + JOIN taxCode tc ON tc.id = ii.taxCodeFk + JOIN invoiceInAwb iia ON iia.invoiceInFk = iii.invoiceInFk + JOIN awb a ON a.id = iia.awbFk + HAVING eurohaber IS NOT NULL; + + -- Linea iva importacion extracomunitaria + + SET @cont:=1; + SET @total:=0; + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + BASEEURO, + CONCEPTO, + FACTURA, + IVA, + AUXILIAR, + SERIE, + FECHA_EX, + FECHA_OP, + FACTURAEX, + NFACTICK, + L340, + LDIFADUAN, + TIPOCLAVE, + TIPOEXENCI, + TIPONOSUJE, + TIPOFACT, + TIPORECTIF, + TERIDNIF, + TERNIF, + TERNOM, + empresa_id, + FECREGCON + ) + + SELECT + vBookNumber ASIEN, + x.FECHA, + x.SUBCTA, + x.CONTRA, + IF (n.isSameCountry OR NOT s.isUeeMember, + x.EURODEBE, + NULL + ) EURODEBE, + x.BASEEURO, + x.CONCEPTO, + vSerialNumber FACTURA, + x.IVA, + '*' AUXILIAR, + x.SERIE, + x.FECHA_EX, + x.FECHA_OP, + x.dua FACTURAEX, + n.invoicesCount NFACTICK, + IF(@total:=@total + x.EURODEBE AND @cont:=@cont + 1 ,1,1) L340, + TRUE LDIFADUAN, + x.TIPOCLAVE, + n.cplusTaxBreakFk TIPOEXENCI, + n.cplusSubjectOpFk TIPONOSUJE, + 5 TIPOFACT, + n.cplusRectificationTypeFk TIPORECTIF, + x.TERIDNIF, + x.TERNIF, + x.TERNOM, + n.companyFk, + IFNULL(x.FECREGCON,n.booked) FECREGCON + + FROM newInvoiceIn n + JOIN newSupplier s + JOIN ( + SELECT + -- CONCAT('COMPRA s/fra ',sref,':',LEFT(p.Proveedor, 10)) + CONCAT('COMPRA s/fra ',ii.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, + tc.code SUBCTA, + s.account CONTRA, + tc.rate IVA, + ROUND(sum(b.buyingValue * b.quantity / intraSub.intrastatSum * taxSub.amount)*(tc.rate/100),2) EURODEBE, + ROUND(sum(b.buyingValue * b.quantity / intraSub.intrastatSum * taxSub.amount),2) BASEEURO, + ii.serial SERIE, + e.supplierFk, + iia.dua, + iis.cplusTerIdNifFk TERIDNIF, + s.nif AS TERNIF, + s.name AS TERNOM, + ii.booked FECREGCON, + ii.cplusTrascendency472Fk TIPOCLAVE, + a.issued FECHA_EX, + a.operated FECHA_OP, + a.bookEntried FECHA + FROM invoiceInAwb iia + JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = iia.invoiceInFk + JOIN awb a ON a.id = iia.awbFk + JOIN invoiceIn ii ON ii.id = iie.invoiceInFk + JOIN invoiceInSerial iis ON iis.code = ii.serial + JOIN buy b ON b.entryFk = iie.entryFk + JOIN item i ON i.id = b.itemFk + JOIN ( + SELECT + i.intrastatFk, + sum(b.buyingValue * b.quantity) as intrastatSum + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN invoiceInEntry iie ON iie.entryFk = b.entryFk + JOIN invoiceInAwb iia ON iia.invoiceInFk = iie.invoiceInAwbFk + JOIN awb aw ON aw.id =iia.awbFk + WHERE iie.percentage AND iia.invoiceInFk = vInvoiceInId + GROUP BY i.intrastatFk + ) intraSub ON intraSub.intrastatFk = i.intrastatFk + JOIN ( + SELECT + iii.intrastatFk, + iii.amount, + intr.taxCodeFk + FROM invoiceInIntrastat iii + JOIN intrastat intr ON intr.id = iii.intrastatFk + WHERE iii.invoiceInFk = vInvoiceInId + ) taxSub ON taxSub.intrastatFk = i.intrastatFk + JOIN taxCode tc ON tc.id = taxSub.taxCodeFk + JOIN entry e ON e.id = iie.entryFk + JOIN supplier s ON s.id = e.supplierFk + WHERE iie.invoiceInAwbFk = vInvoiceInId AND iie.percentage + GROUP BY e.supplierFk, taxSub.taxCodeFk + ) x + GROUP BY x.supplierFk, x.IVA; + + /*UPDATE newInvoiceIn n + JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = vInvoiceInId + JOIN invoiceIn ii ON ii.id = iie.invoiceInFk + SET ii.isBooked = TRUE, + ii.booked = IFNULL(ii.booked,n.booked), + ii.operated = IFNULL(ii.operated,n.operated), + ii.issued = IFNULL(ii.issued,n.issued);*/ + +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 DROP PROCEDURE IF EXISTS `invoiceInBookingkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingkk`(vInvoiceInId INT) +BEGIN + /* OBSOLETO usar invoiceInBookingMain o invoiceInBookingExtra */ DECLARE vSerialNumber, vBookNumber, vBookNumberPlus1 INT; DECLARE vTotalAmount DECIMAL(10,2); @@ -50650,838 +50465,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `invoiceInBookingCommon` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingCommon`(vInvoiceInId INT, OUT vSerialNumber INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS newInvoiceIn; - - CREATE TEMPORARY TABLE newInvoiceIn - SELECT - i.*, - YEAR(i.booked) datedYear, - -- CONCAT('s/fra',RIGHT(i.supplierRef,8)) concept, - CONCAT('s/fra',RIGHT(i.supplierRef,8),':',LEFT(s.name, 10)) conceptWithSupplier, - (cc.id = c.id) isSameCountry, - cit.id invoicesCount - FROM invoiceIn i - JOIN cplusInvoiceType472 cit ON cit.id = i.cplusInvoiceType472Fk - JOIN supplier s ON s.id = i.supplierFk - JOIN country c ON c.id = s.countryFk - JOIN supplier sc ON sc.id = i.companyFk - JOIN country cc ON cc.id = sc.countryFk - WHERE i.id = vInvoiceInId; - - DROP TEMPORARY TABLE IF EXISTS newSupplier; - CREATE TEMPORARY TABLE newSupplier - SELECT - s.*, - REPLACE(s.account,' ','') supplierAccount, - IF(c.CEE < 2, TRUE, FALSE) isUeeMember - FROM supplier s - JOIN newInvoiceIn n - JOIN country c ON c.id = s.countryFk - WHERE s.id = n.supplierFk; - - IF (SELECT isActive FROM newSupplier) = 0 THEN - CALL util.throw('INACTIVE_PROVIDER'); - END IF; - - SELECT IFNULL(MAX(i.serialNumber) + 1,1) - INTO vSerialNumber - FROM invoiceIn i - JOIN newInvoiceIn n - WHERE i.serial LIKE n.serial - AND YEAR(i.booked) = n.datedYear - AND i.companyFk = n.companyFk - GROUP BY i.companyFk; - -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 DROP PROCEDURE IF EXISTS `invoiceInBookingExtra` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingExtra`(vInvoiceInId INT) -BEGIN - DECLARE vBookNumber,vSerialNumber INT; - - CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); - - SELECT MAX(ASIEN) + 1 - INTO vBookNumber - FROM vn2008.XDiario; - - -- Extracomunitarias gasto contra proveedor/acreedor - INSERT INTO vn2008.XDiario ( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - CONCEPTO, - NFACTICK, - empresa_id - ) - SELECT - vBookNumber ASIEN, - IFNULL(a.booked, n.booked) FECHA, - iit.expenceFk SUBCTA, - s.account CONTRA, - ROUND(SUM(iit.taxableBase) * (iie.percentage / 100),2) EURODEBE, - CONCAT('COMPRA s/fra ',i.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, - n.invoicesCount NFACTICK, - n.companyFk empresa_id - FROM newInvoiceIn n - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = n.id - JOIN invoiceInTax iit ON iit.invoiceInFk = iie.invoiceInFk - JOIN invoiceIn i ON i.id = iit.invoiceInFk - JOIN supplier s ON s.id = i.supplierFk - LEFT JOIN invoiceInAwb iia ON iia.invoiceInFk = n.id - LEFT JOIN awb a ON a.id = iia.awbFk - WHERE iie.percentage - GROUP BY i.id; - - -- Extracomunitarias proveedor contra gasto - INSERT INTO vn2008.XDiario ( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EUROHABER, - CONCEPTO, - NFACTICK, - empresa_id - ) - SELECT - vBookNumber ASIEN, - IFNULL(a.booked, n.booked) FECHA, - s.account SUBCTA, - iit.expenceFk CONTRA, - ROUND(SUM(iit.taxableBase) * (iie.percentage / 100),2) EUROHABER, - CONCAT('COMPRA s/fra ',i.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, - n.invoicesCount NFACTICK, - n.companyFk empresa_id - FROM newInvoiceIn n - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = n.id - JOIN invoiceInTax iit ON iit.invoiceInFk = iie.invoiceInFk - JOIN invoiceIn i ON i.id = iit.invoiceInFk - JOIN supplier s ON s.id = i.supplierFk - LEFT JOIN invoiceInAwb iia ON iia.invoiceInFk = n.id - LEFT JOIN awb a ON a.id = iia.awbFk - WHERE iie.percentage - GROUP BY i.id; - - -- Iva Importacion pendiente - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONCEPTO, - EUROHABER,-- EURODEBE - SERIE, - empresa_id) - - SELECT - vBookNumber, - a.booked, - '4700000999', - n.conceptWithSupplier, - ROUND(SUM(iii.amount * (tc.rate/100)),2) eurohaber, - n.serial, - n.companyFk - FROM newInvoiceIn n - JOIN invoiceInIntrastat iii ON n.id = iii.invoiceInFk - JOIN intrastat ii ON ii.id = iii.intrastatFk - JOIN taxCode tc ON tc.id = ii.taxCodeFk - JOIN invoiceInAwb iia ON iia.invoiceInFk = iii.invoiceInFk - JOIN awb a ON a.id = iia.awbFk - HAVING eurohaber IS NOT NULL; - - -- Linea iva importacion extracomunitaria - - SET @cont:=1; - SET @total:=0; - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - BASEEURO, - CONCEPTO, - FACTURA, - IVA, - AUXILIAR, - SERIE, - FECHA_EX, - FECHA_OP, - FACTURAEX, - NFACTICK, - L340, - LDIFADUAN, - TIPOCLAVE, - TIPOEXENCI, - TIPONOSUJE, - TIPOFACT, - TIPORECTIF, - TERIDNIF, - TERNIF, - TERNOM, - empresa_id, - FECREGCON - ) - - SELECT - vBookNumber ASIEN, - x.FECHA, - x.SUBCTA, - x.CONTRA, - IF (n.isSameCountry OR NOT s.isUeeMember, - x.EURODEBE, - NULL - ) EURODEBE, - x.BASEEURO, - x.CONCEPTO, - vSerialNumber FACTURA, - x.IVA, - '*' AUXILIAR, - x.SERIE, - x.FECHA_EX, - x.FECHA_OP, - x.dua FACTURAEX, - n.invoicesCount NFACTICK, - IF(@total:=@total + x.EURODEBE AND @cont:=@cont + 1 ,1,1) L340, - TRUE LDIFADUAN, - x.TIPOCLAVE, - n.cplusTaxBreakFk TIPOEXENCI, - n.cplusSubjectOpFk TIPONOSUJE, - 5 TIPOFACT, - n.cplusRectificationTypeFk TIPORECTIF, - x.TERIDNIF, - x.TERNIF, - x.TERNOM, - n.companyFk, - IFNULL(x.FECREGCON,n.booked) FECREGCON - - FROM newInvoiceIn n - JOIN newSupplier s - JOIN ( - SELECT - -- CONCAT('COMPRA s/fra ',sref,':',LEFT(p.Proveedor, 10)) - CONCAT('COMPRA s/fra ',ii.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, - tc.code SUBCTA, - s.account CONTRA, - tc.rate IVA, - ROUND(sum(b.buyingValue * b.quantity / intraSub.intrastatSum * taxSub.amount)*(tc.rate/100),2) EURODEBE, - ROUND(sum(b.buyingValue * b.quantity / intraSub.intrastatSum * taxSub.amount),2) BASEEURO, - ii.serial SERIE, - e.supplierFk, - iia.dua, - iis.cplusTerIdNifFk TERIDNIF, - s.nif AS TERNIF, - s.name AS TERNOM, - ii.booked FECREGCON, - ii.cplusTrascendency472Fk TIPOCLAVE, - a.issued FECHA_EX, - a.operated FECHA_OP, - a.booked FECHA - FROM invoiceInAwb iia - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = iia.invoiceInFk - JOIN awb a ON a.id = iia.awbFk - JOIN invoiceIn ii ON ii.id = iie.invoiceInFk - JOIN invoiceInSerial iis ON iis.code = ii.serial - JOIN buy b ON b.entryFk = iie.entryFk - JOIN item i ON i.id = b.itemFk - JOIN ( - SELECT - i.intrastatFk, - sum(b.buyingValue * b.quantity) as intrastatSum - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN invoiceInEntry iie ON iie.entryFk = b.entryFk - JOIN invoiceInAwb iia ON iia.invoiceInFk = iie.invoiceInAwbFk - JOIN awb aw ON aw.id =iia.awbFk - WHERE iie.percentage AND iia.invoiceInFk = vInvoiceInId - GROUP BY i.intrastatFk - ) intraSub ON intraSub.intrastatFk = i.intrastatFk - JOIN ( - SELECT - iii.intrastatFk, - iii.amount, - intr.taxCodeFk - FROM invoiceInIntrastat iii - JOIN intrastat intr ON intr.id = iii.intrastatFk - WHERE iii.invoiceInFk = vInvoiceInId - ) taxSub ON taxSub.intrastatFk = i.intrastatFk - JOIN taxCode tc ON tc.id = taxSub.taxCodeFk - JOIN entry e ON e.id = iie.entryFk - JOIN supplier s ON s.id = e.supplierFk - WHERE iie.invoiceInAwbFk = vInvoiceInId AND iie.percentage - GROUP BY e.supplierFk, taxSub.taxCodeFk - ) x - GROUP BY x.supplierFk, x.IVA; - - -- Actualizacion de la fecha de contabilizado y de operacion de las importaciones - UPDATE newInvoiceIn n - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = vInvoiceInId - JOIN invoiceIn ii ON ii.id = iie.invoiceInFk - SET ii.isBooked = TRUE, - ii.booked = IFNULL(ii.booked,n.booked), - ii.operated = IFNULL(ii.operated,n.issued); -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 DROP PROCEDURE IF EXISTS `invoiceInBookingkk` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingkk`(vInvoiceInId INT) -BEGIN - DECLARE vDocument VARCHAR(255); - DECLARE vSerialNumber, vBookNumber, vBookNumberPlus1 INT; - DECLARE vTotalAmount DECIMAL(10,2); - - DROP TEMPORARY TABLE IF EXISTS newInvoiceIn; - - CREATE TEMPORARY TABLE newInvoiceIn - SELECT - i.*, - YEAR(i.booked) datedYear, - -- CONCAT('s/fra',RIGHT(i.supplierRef,8)) concept, - CONCAT('s/fra',RIGHT(i.supplierRef,8),':',LEFT(s.name, 10)) conceptWithSupplier, - (cc.id = c.id) isSameCountry, - cit.id invoicesCount - FROM invoiceIn i - JOIN cplusInvoiceType472 cit ON cit.id = i.cplusInvoiceType472Fk - JOIN supplier s ON s.id = i.supplierFk - JOIN country c ON c.id = s.countryFk - JOIN supplier sc ON sc.id = i.companyFk - JOIN country cc ON cc.id = sc.countryFk - WHERE i.id = vInvoiceInId; - - DROP TEMPORARY TABLE IF EXISTS newSupplier; - CREATE TEMPORARY TABLE newSupplier - SELECT - s.*, - REPLACE(s.account,' ','') supplierAccount, - IF(c.CEE < 2, TRUE, FALSE) isUeeMember - FROM supplier s - JOIN newInvoiceIn n - JOIN country c ON c.id = s.countryFk - WHERE s.id = n.supplierFk; - - IF (SELECT isActive FROM newSupplier) = 0 THEN - CALL util.throw('INACTIVE_PROVIDER'); - END IF; - - SELECT IFNULL(MAX(i.serialNumber) + 1,1) - INTO vSerialNumber - FROM invoiceIn i - JOIN newInvoiceIn n - WHERE i.serial LIKE n.serial - AND YEAR(i.booked) = n.datedYear - AND i.companyFk = n.companyFk - GROUP BY i.companyFk; - - SELECT MAX(ASIEN) + 1 - INTO vBookNumber - FROM vn2008.XDiario; - - SET vBookNumberPlus1 = vBookNumber + 1; - - SELECT CONCAT(serial,'/', LPAD(vSerialNumber,5,'0')) - INTO vDocument - FROM newInvoiceIn; - - SELECT SUM(iit.taxableBase * IF(i.serial = 'R', 1 +(tc.rate/100),1)) - INTO vTotalAmount - FROM invoiceIn i - JOIN invoiceInTax iit ON iit.invoiceInFk = i.id - JOIN taxCode tc ON iit.taxCodeFk = tc.id - WHERE i.id = vInvoiceInId; - /* - select vSerialNumber,vBookNumber,vDocument,vTotalAmount; - */ - -- Apunte del proveedor - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - EUROHABER, - CONCEPTO, - NFACTICK, - empresa_id) - SELECT - vBookNumber, - n.booked, - s.supplierAccount, - vTotalAmount, - n.conceptWithSupplier, - n.invoicesCount, - n.companyFk - FROM newInvoiceIn n - JOIN newSupplier s; - - -- ----------------------------------------------------------- Linea de Gastos - INSERT INTO vn2008.XDiario ( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - EUROHABER, - CONCEPTO, - NFACTICK, - empresa_id - ) - SELECT - vBookNumber ASIEN, - n.booked FECHA, - if( - e.isWithheld, - LPAD(RIGHT(s.supplierAccount ,5),10,iit.expenceFk), - iit.expenceFk - ) SUBCTA, - s.supplierAccount CONTRA, - if( - e.isWithheld, - NULL, - ABS(ROUND(SUM(iit.taxableBase),2)) - ) EURODEBE, - if( - e.isWithheld, - ABS(ROUND(SUM(iit.taxableBase),2)), - NULL - ) EUROHABER, - n.conceptWithSupplier CONCEPTO, - n.invoicesCount NFACTICK, - n.companyFk empresa_id - FROM newInvoiceIn n - JOIN newSupplier s - JOIN invoiceInTax iit ON iit.invoiceInFk = n.id - JOIN taxCode tc ON tc.id = iit.taxCodeFk - JOIN expence e ON e.id = iit.expenceFk AND e.taxTypeFk = tc.taxTypeFk - WHERE iit.expenceFk != 5660000002 - GROUP BY iit.expenceFk; - - -- Extracomunitarias gasto contra proveedor/acreedor - INSERT INTO vn2008.XDiario ( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - CONCEPTO, - NFACTICK, - empresa_id - ) - SELECT - vBookNumberPlus1 ASIEN, - IFNULL(a.booked, n.booked) FECHA, - iit.expenceFk SUBCTA, - s.account CONTRA, - ROUND(SUM(iit.taxableBase) * (iie.percentage / 100),2) EURODEBE, - CONCAT('COMPRA s/fra ',i.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, - n.invoicesCount NFACTICK, - n.companyFk empresa_id - FROM newInvoiceIn n - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = n.id - JOIN invoiceInTax iit ON iit.invoiceInFk = iie.invoiceInFk - JOIN invoiceIn i ON i.id = iit.invoiceInFk - JOIN supplier s ON s.id = i.supplierFk - LEFT JOIN invoiceInAwb iia ON iia.invoiceInFk = n.id - LEFT JOIN awb a ON a.id = iia.awbFk - WHERE iie.percentage - GROUP BY i.id; - - -- Extracomunitarias proveedor contra gasto - INSERT INTO vn2008.XDiario ( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EUROHABER, - CONCEPTO, - NFACTICK, - empresa_id - ) - SELECT - vBookNumberPlus1 ASIEN, - IFNULL(a.booked, n.booked) FECHA, - s.account SUBCTA, - iit.expenceFk CONTRA, - ROUND(SUM(iit.taxableBase) * (iie.percentage / 100),2) EUROHABER, - CONCAT('COMPRA s/fra ',i.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, - n.invoicesCount NFACTICK, - n.companyFk empresa_id - FROM newInvoiceIn n - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = n.id - JOIN invoiceInTax iit ON iit.invoiceInFk = iie.invoiceInFk - JOIN invoiceIn i ON i.id = iit.invoiceInFk - JOIN supplier s ON s.id = i.supplierFk - LEFT JOIN invoiceInAwb iia ON iia.invoiceInFk = n.id - LEFT JOIN awb a ON a.id = iia.awbFk - WHERE iie.percentage - GROUP BY i.id; - - -- -------------------------------------------------------------------- - -- ------- Lineas de IVA --------------- - -- -------------------------------------------------------------------- - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - BASEEURO, - CONCEPTO, - FACTURA, - IVA, - AUXILIAR, - SERIE, - TIPOOPE, - FECHA_EX, - FECHA_OP, - NFACTICK, - FACTURAEX, - L340, - LRECT349, - TIPOCLAVE, - TIPOEXENCI, - TIPONOSUJE, - TIPOFACT, - TIPORECTIF, - TERIDNIF, - TERNIF, - TERNOM, - FECREGCON, - empresa_id - ) - SELECT - vBookNumber ASIEN, - n.booked FECHA, - tc.code SUBCTA, - s.supplierAccount CONTRA, - ROUND(tc.rate/100*it.taxableBase + 0.0001,2) EURODEBE, - it.taxableBase BASEEURO, - GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, - vSerialNumber FACTURA, - tc.rate IVA, - IF(isUeeMember AND eWithheld.id IS NULL,'','*') AUXILIAR, - n.serial SERIE, - tt.TIPOOPE, - n.issued FECHA_EX, - n.operated FECHA_OP, - n.invoicesCount NFACTICK, - n.supplierRef FACTURAEX, - TRUE L340, - (isSameCountry OR NOT isUeeMember) LRECT349, - n.cplusTrascendency472Fk TIPOCLAVE, - n.cplusTaxBreakFk TIPOEXENCI, - n.cplusSubjectOpFk TIPONOSUJE, - n.cplusInvoiceType472Fk TIPOFACT, - n.cplusRectificationTypeFk TIPORECTIF, - iis.cplusTerIdNifFk TERIDNIF, - s.nif AS TERNIF, - s.name AS TERNOM, - n.booked FECREGCON, - n.companyFk - - FROM newInvoiceIn n - JOIN newSupplier s - JOIN invoiceInTax it ON n.id = it.invoiceInFk - JOIN taxCode tc ON tc.id = it.taxCodeFk - JOIN taxType tt ON tt.id = tc.taxTypeFk - JOIN invoiceInSerial iis ON iis.code = tt.serial - JOIN expence e ON e.id = it.expenceFk AND e.taxTypeFk = tc.taxTypeFk - LEFT JOIN invoiceInTax hold ON hold.invoiceInFk = n.id - LEFT JOIN expence eWithheld ON eWithheld.id = hold.expenceFk AND eWithheld.isWithheld - WHERE tc.type != '-' - AND tc.isActive - GROUP BY tc.rate; - - -- Linea iva inversor sujeto pasivo - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EUROHABER, - BASEEURO, - CONCEPTO, - FACTURA, - IVA, - AUXILIAR, - SERIE, - TIPOOPE, - FECHA_EX, - FECHA_OP, - NFACTICK, - FACTURAEX, - L340, - LRECT349, - TIPOCLAVE, - TIPOEXENCI, - TIPONOSUJE, - TIPOFACT, - TIPORECTIF, - TERIDNIF, - TERNIF, - TERNOM, - empresa_id - ) - - SELECT - vBookNumber ASIEN, - n.booked FECHA, - tcLink.code SUBCTA, - s.supplierAccount CONTRA, - ROUND(tcLink.rate/100*SUM(it.taxableBase) + 0.0001,2) EUROHABER, - ROUND(SUM(it.taxableBase),2) BASEEURO, - GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, - vSerialNumber FACTURA, - tcLink.rate IVA, - '*' AUXILIAR, - n.serial SERIE, - tt.TIPOOPE, - n.issued FECHA_EX, - n.operated FECHA_OP, - n.invoicesCount NFACTICK, - n.supplierRef FACTURAEX, - FALSE L340, - (isSameCountry OR NOT isUeeMember) LRECT349, - 1 TIPOCLAVE, - n.cplusTaxBreakFk TIPOEXENCI, - n.cplusSubjectOpFk TIPONOSUJE, - n.cplusInvoiceType472Fk TIPOFACT, - n.cplusRectificationTypeFk TIPORECTIF, - iis.cplusTerIdNifFk TERIDNIF, - s.nif AS TERNIF, - s.name AS TERNOM, - n.companyFk - - FROM newInvoiceIn n - JOIN newSupplier s - JOIN invoiceInTax it ON n.id = it.invoiceInFk - JOIN taxCode tc ON tc.id = it.taxCodeFk - JOIN taxType tt ON tt.id = tc.taxTypeFk - JOIN invoiceInSerial iis ON iis.code = tt.serial - JOIN taxCode tcLink ON tcLink.linkFk = tc.linkFk AND tc.id != tcLink.id - JOIN expence e ON e.id = it.expenceFk AND e.taxTypeFk = tc.taxTypeFk - WHERE tc.isActive - GROUP BY tcLink.rate, e.id; - - -- Iva Importacion pendiente - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONCEPTO, - EUROHABER,-- EURODEBE - SERIE, - empresa_id) - - SELECT - vBookNumberPlus1, - a.booked, - '4700000999', - n.conceptWithSupplier, - ROUND(SUM(iii.amount * (tc.rate/100)),2) eurohaber, - n.serial, - n.companyFk - FROM newInvoiceIn n - JOIN invoiceInIntrastat iii ON n.id = iii.invoiceInFk - JOIN intrastat ii ON ii.id = iii.intrastatFk - JOIN taxCode tc ON tc.id = ii.taxCodeFk - JOIN invoiceInAwb iia ON iia.invoiceInFk = iii.invoiceInFk - JOIN awb a ON a.id = iia.awbFk - HAVING eurohaber IS NOT NULL; - - - -- Linea iva importacion extracomunitaria - - SET @cont:=1; - SET @total:=0; - SET @base:=2; - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - BASEEURO, - CONCEPTO, - FACTURA, - IVA, - AUXILIAR, - SERIE, - FECHA_EX, - FECHA_OP, - FACTURAEX, - NFACTICK, - L340, - LDIFADUAN, - TIPOCLAVE, - TIPOEXENCI, - TIPONOSUJE, - TIPOFACT, - TIPORECTIF, - TERIDNIF, - TERNIF, - TERNOM, - empresa_id, - FECREGCON - ) - - SELECT - vBookNumberPlus1 ASIEN, - x.FECHA, - x.SUBCTA, - x.CONTRA, - IF (n.isSameCountry OR NOT s.isUeeMember, - x.EURODEBE, - NULL - ) EURODEBE, - x.BASEEURO, - x.CONCEPTO, - vSerialNumber FACTURA, - x.IVA, - '*' AUXILIAR, - x.SERIE, - x.FECHA_EX, - x.FECHA_OP, - x.dua FACTURAEX, - n.invoicesCount NFACTICK, - IF(@total:=@total + x.EURODEBE AND @cont:=@cont + 1 ,1,1) L340, - TRUE LDIFADUAN, - x.TIPOCLAVE, - n.cplusTaxBreakFk TIPOEXENCI, - n.cplusSubjectOpFk TIPONOSUJE, - 5 TIPOFACT, - n.cplusRectificationTypeFk TIPORECTIF, - x.TERIDNIF, - x.TERNIF, - x.TERNOM, - n.companyFk, - IFNULL(x.FECREGCON,n.booked) FECREGCON - - FROM newInvoiceIn n - JOIN newSupplier s - JOIN ( - SELECT - -- CONCAT('COMPRA s/fra ',sref,':',LEFT(p.Proveedor, 10)) - CONCAT('COMPRA s/fra ',ii.supplierRef,':',LEFT(s.name, 10)) CONCEPTO, - tc.code SUBCTA, - s.account CONTRA, - tc.rate IVA, - ROUND(sum(b.buyingValue * b.quantity / intraSub.intrastatSum * taxSub.amount)*(tc.rate/100),2) EURODEBE, - ROUND(sum(b.buyingValue * b.quantity / intraSub.intrastatSum * taxSub.amount),2) BASEEURO, - ii.serial SERIE, - e.supplierFk, - iia.dua, - iis.cplusTerIdNifFk TERIDNIF, - s.nif AS TERNIF, - s.name AS TERNOM, - ii.booked FECREGCON, - ii.cplusTrascendency472Fk TIPOCLAVE, - a.issued FECHA_EX, - a.operated FECHA_OP, - a.booked FECHA - FROM invoiceInAwb iia - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = iia.invoiceInFk - JOIN awb a ON a.id = iia.awbFk - JOIN invoiceIn ii ON ii.id = iie.invoiceInFk - JOIN invoiceInSerial iis ON iis.code = ii.serial - JOIN buy b ON b.entryFk = iie.entryFk - JOIN item i ON i.id = b.itemFk - JOIN ( - SELECT - i.intrastatFk, - sum(b.buyingValue * b.quantity) as intrastatSum - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN invoiceInEntry iie - ON iie.entryFk = b.entryFk - JOIN invoiceInAwb iia - ON iia.invoiceInFk = iie.invoiceInAwbFk - JOIN awb aw ON aw.id =iia.awbFk - WHERE iie.percentage AND iia.invoiceInFk = vInvoiceInId - GROUP BY i.intrastatFk - ) intraSub ON intraSub.intrastatFk = i.intrastatFk - JOIN ( - SELECT - iii.intrastatFk, - iii.amount, - intr.taxCodeFk - FROM invoiceInIntrastat iii - JOIN intrastat intr - ON intr.id = iii.intrastatFk - WHERE iii.invoiceInFk = vInvoiceInId - ) taxSub ON taxSub.intrastatFk = i.intrastatFk - JOIN taxCode tc ON tc.id = taxSub.taxCodeFk - JOIN entry e ON e.id = iie.entryFk - JOIN supplier s ON s.id = e.supplierFk - WHERE iie.invoiceInAwbFk = vInvoiceInId AND iie.percentage - GROUP BY e.supplierFk, taxSub.taxCodeFk - ) x - GROUP BY x.supplierFk, x.IVA; - - -- Actualizacion de la fecha de contabilizado y de operacion de las importaciones - UPDATE newInvoiceIn n - JOIN invoiceInEntry iie ON iie.invoiceInAwbFk = vInvoiceInId - JOIN invoiceIn ii ON ii.id = iie.invoiceInFk - SET ii.booked = IFNULL(ii.booked,n.booked), - ii.operated = IFNULL(ii.operated,n.issued); - - -- Actualización del registro original - UPDATE invoiceIn - SET - serialNumber = vSerialNumber, - isBooked = TRUE - WHERE - id = vInvoiceInId; -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 DROP PROCEDURE IF EXISTS `invoiceInBookingMain` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -51494,21 +50477,24 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingMain`(vInvoiceInId INT) BEGIN - DECLARE vTotalAmount DECIMAL(10,2); + DECLARE vTotalAmount,vTotalAmountDivisa DECIMAL(10,2); DECLARE vBookNumber,vSerialNumber INT; + DECLARE vRate DECIMAL(10,4); CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); + + SELECT SUM(iit.taxableBase * IF(i.serial = 'R', 1 +(tc.rate/100),1)), + SUM(iit.foreignValue * IF(i.serial = 'R', 1 +(tc.rate/100),1)), + iit.taxableBase/iit.foreignValue + INTO vTotalAmount, vTotalAmountDivisa, vRate + FROM newInvoiceIn i + JOIN invoiceInTax iit ON iit.invoiceInFk = i.id + JOIN taxCode tc ON iit.taxCodeFk = tc.id; SELECT MAX(ASIEN) + 1 INTO vBookNumber FROM vn2008.XDiario; - - SELECT SUM(iit.taxableBase * IF(i.serial = 'R', 1 +(tc.rate/100),1)) - INTO vTotalAmount - FROM newInvoiceIn i - JOIN invoiceInTax iit ON iit.invoiceInFk = i.id - JOIN taxCode tc ON iit.taxCodeFk = tc.id; - + -- Apunte del proveedor INSERT INTO vn2008.XDiario( @@ -51517,15 +50503,21 @@ BEGIN SUBCTA, EUROHABER, CONCEPTO, + CAMBIO, + HABERME, NFACTICK, + CLAVE, empresa_id) SELECT vBookNumber, - n.booked, + n.bookEntried, s.supplierAccount, vTotalAmount, n.conceptWithSupplier, + vRate, + vTotalAmountDivisa, n.invoicesCount, + vInvoiceInId, n.companyFk FROM newInvoiceIn n JOIN newSupplier s; @@ -51539,36 +50531,50 @@ BEGIN EURODEBE, EUROHABER, CONCEPTO, + CAMBIO, + DEBEME, + HABERME, NFACTICK, empresa_id ) SELECT - vBookNumber ASIEN, - n.booked FECHA, - if( - e.isWithheld, - LPAD(RIGHT(s.supplierAccount ,5),10,iit.expenceFk), - iit.expenceFk - ) SUBCTA, - s.supplierAccount CONTRA, - if( - e.isWithheld, - NULL, - ABS(ROUND(SUM(iit.taxableBase),2)) - ) EURODEBE, - if( - e.isWithheld, - ABS(ROUND(SUM(iit.taxableBase),2)), - NULL - ) EUROHABER, - n.conceptWithSupplier CONCEPTO, - n.invoicesCount NFACTICK, - n.companyFk empresa_id + vBookNumber ASIEN, + n.bookEntried FECHA, + if( + e.isWithheld, + LPAD(RIGHT(s.supplierAccount,5),10,iit.expenceFk), + iit.expenceFk + ) SUBCTA, + s.supplierAccount CONTRA, + if( + e.isWithheld, + NULL, + ABS(ROUND(SUM(iit.taxableBase),2)) + ) EURODEBE, + if( + e.isWithheld, + ABS(ROUND(SUM(iit.taxableBase),2)), + NULL + ) EUROHABER, + n.conceptWithSupplier CONCEPTO, + vRate, + if( + e.isWithheld, + NULL, + ABS(ROUND(SUM(iit.foreignValue),2)) + ) DEBEME, + if( + e.isWithheld, + ABS(ROUND(SUM(iit.foreignValue),2)), + NULL + ) HABERME, + n.invoicesCount NFACTICK, + n.companyFk empresa_id FROM newInvoiceIn n - JOIN newSupplier s - JOIN invoiceInTax iit ON iit.invoiceInFk = n.id - JOIN taxCode tc ON tc.id = iit.taxCodeFk - JOIN expence e ON e.id = iit.expenceFk AND e.taxTypeFk = tc.taxTypeFk + JOIN newSupplier s + JOIN invoiceInTax iit ON iit.invoiceInFk = n.id + JOIN taxCode tc ON tc.id = iit.taxCodeFk + JOIN expence e ON e.id = iit.expenceFk AND e.taxTypeFk = tc.taxTypeFk WHERE iit.expenceFk != 5660000002 GROUP BY iit.expenceFk; @@ -51608,7 +50614,7 @@ BEGIN empresa_id ) SELECT vBookNumber ASIEN, - n.booked FECHA, + n.bookEntried FECHA, tc.code SUBCTA, s.supplierAccount CONTRA, SUM(ROUND(tc.rate/100*it.taxableBase + 0.0001,2)) EURODEBE, @@ -51687,7 +50693,262 @@ BEGIN SELECT vBookNumber ASIEN, - n.booked FECHA, + n.bookEntried FECHA, + tcLink.code SUBCTA, + s.supplierAccount CONTRA, + ROUND(tcLink.rate/100*SUM(it.taxableBase) + 0.0001,2) EUROHABER, + ROUND(SUM(it.taxableBase),2) BASEEURO, + GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, + vSerialNumber FACTURA, + tcLink.rate IVA, + '*' AUXILIAR, + n.serial SERIE, + tt.TIPOOPE, + n.issued FECHA_EX, + n.operated FECHA_OP, + n.invoicesCount NFACTICK, + n.supplierRef FACTURAEX, + FALSE L340, + (isSameCountry OR NOT isUeeMember) LRECT349, + 1 TIPOCLAVE, + n.cplusTaxBreakFk TIPOEXENCI, + n.cplusSubjectOpFk TIPONOSUJE, + n.cplusInvoiceType472Fk TIPOFACT, + n.cplusRectificationTypeFk TIPORECTIF, + iis.cplusTerIdNifFk TERIDNIF, + s.nif AS TERNIF, + s.name AS TERNOM, + n.companyFk + + FROM newInvoiceIn n + JOIN newSupplier s + JOIN invoiceInTax it ON n.id = it.invoiceInFk + JOIN taxCode tc ON tc.id = it.taxCodeFk + JOIN taxType tt ON tt.id = tc.taxTypeFk + JOIN invoiceInSerial iis ON iis.code = tt.serial + JOIN taxCode tcLink ON tcLink.link = tc.link AND tc.id != tcLink.id + JOIN expence e ON e.id = it.expenceFk AND e.taxTypeFk = tc.taxTypeFk + WHERE tc.isActive + GROUP BY tcLink.rate, e.id; + +-- Actualización del registro original + UPDATE invoiceIn ii + JOIN newInvoiceIn ni ON ii.id = ni.id + SET + ii.serialNumber = vSerialNumber, + ii.isBooked = TRUE; +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 DROP PROCEDURE IF EXISTS `invoiceInBookingMainkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceInBookingMainkk`(vInvoiceInId INT) +BEGIN + DECLARE vTotalAmount DECIMAL(10,2); + DECLARE vBookNumber,vSerialNumber INT; + + CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); + + SELECT SUM(iit.taxableBase * IF(i.serial = 'R', 1 +(tc.rate/100),1)) + INTO vTotalAmount + FROM newInvoiceIn i + JOIN invoiceInTax iit ON iit.invoiceInFk = i.id + JOIN taxCode tc ON iit.taxCodeFk = tc.id; + + SELECT MAX(ASIEN) + 1 + INTO vBookNumber + FROM vn2008.XDiario; + + -- Apunte del proveedor + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + EUROHABER, + CONCEPTO, + NFACTICK, + empresa_id) + SELECT + vBookNumber, + n.bookEntried, + s.supplierAccount, + vTotalAmount, + n.conceptWithSupplier, + n.invoicesCount, + n.companyFk + FROM newInvoiceIn n + JOIN newSupplier s; + + -- ----------------------------------------------------------- Linea de Gastos + INSERT INTO vn2008.XDiario ( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + EUROHABER, + CONCEPTO, + NFACTICK, + empresa_id + ) + SELECT + vBookNumber ASIEN, + n.bookEntried FECHA, + if( + e.isWithheld, + LPAD(RIGHT(s.supplierAccount ,5),10,iit.expenceFk), + iit.expenceFk + ) SUBCTA, + s.supplierAccount CONTRA, + if( + e.isWithheld, + NULL, + ABS(ROUND(SUM(iit.taxableBase),2)) + ) EURODEBE, + if( + e.isWithheld, + ABS(ROUND(SUM(iit.taxableBase),2)), + NULL + ) EUROHABER, + n.conceptWithSupplier CONCEPTO, + n.invoicesCount NFACTICK, + n.companyFk empresa_id + FROM newInvoiceIn n + JOIN newSupplier s + JOIN invoiceInTax iit ON iit.invoiceInFk = n.id + JOIN taxCode tc ON tc.id = iit.taxCodeFk + JOIN expence e ON e.id = iit.expenceFk AND e.taxTypeFk = tc.taxTypeFk + WHERE iit.expenceFk != 5660000002 + GROUP BY iit.expenceFk; + + + -- -------------------------------------------------------------------- + -- ------- Lineas de IVA --------------- + -- -------------------------------------------------------------------- + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + BASEEURO, + CONCEPTO, + FACTURA, + IVA, + AUXILIAR, + SERIE, + TIPOOPE, + FECHA_EX, + FECHA_OP, + NFACTICK, + FACTURAEX, + L340, + LRECT349, + TIPOCLAVE, + TIPOEXENCI, + TIPONOSUJE, + TIPOFACT, + TIPORECTIF, + TERIDNIF, + TERNIF, + TERNOM, + FECREGCON, + empresa_id + ) + SELECT vBookNumber ASIEN, + n.bookEntried FECHA, + tc.code SUBCTA, + s.supplierAccount CONTRA, + SUM(ROUND(tc.rate/100*it.taxableBase + 0.0001,2)) EURODEBE, + SUM(it.taxableBase) BASEEURO, + GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, + vSerialNumber FACTURA, + tc.rate IVA, + IF(isUeeMember AND eWithheld.id IS NULL,'','*') AUXILIAR, + n.serial SERIE, + tt.TIPOOPE, + n.issued FECHA_EX, + n.operated FECHA_OP, + n.invoicesCount NFACTICK, + n.supplierRef FACTURAEX, + TRUE L340, + (isSameCountry OR NOT isUeeMember) LRECT349, + n.cplusTrascendency472Fk TIPOCLAVE, + n.cplusTaxBreakFk TIPOEXENCI, + n.cplusSubjectOpFk TIPONOSUJE, + n.cplusInvoiceType472Fk TIPOFACT, + n.cplusRectificationTypeFk TIPORECTIF, + iis.cplusTerIdNifFk TERIDNIF, + s.nif AS TERNIF, + s.name AS TERNOM, + n.booked FECREGCON, + n.companyFk + + FROM newInvoiceIn n + JOIN newSupplier s + JOIN invoiceInTax it ON n.id = it.invoiceInFk + JOIN taxCode tc ON tc.id = it.taxCodeFk + JOIN taxType tt ON tt.id = tc.taxTypeFk + JOIN invoiceInSerial iis ON iis.code = tt.serial + JOIN expence e ON e.id = it.expenceFk AND e.taxTypeFk = tc.taxTypeFk + LEFT JOIN + (SELECT eWithheld.id + FROM invoiceInTax hold + JOIN expence eWithheld ON eWithheld.id = hold.expenceFk AND eWithheld.isWithheld + WHERE hold.invoiceInFk = 58262 LIMIT 1 + ) eWithheld ON TRUE + WHERE tc.type != '-' + AND tc.isActive + GROUP BY tc.rate; + + -- Linea iva inversor sujeto pasivo + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EUROHABER, + BASEEURO, + CONCEPTO, + FACTURA, + IVA, + AUXILIAR, + SERIE, + TIPOOPE, + FECHA_EX, + FECHA_OP, + NFACTICK, + FACTURAEX, + L340, + LRECT349, + TIPOCLAVE, + TIPOEXENCI, + TIPONOSUJE, + TIPOFACT, + TIPORECTIF, + TERIDNIF, + TERNIF, + TERNOM, + empresa_id + ) + + SELECT + vBookNumber ASIEN, + n.bookEntried FECHA, tcLink.code SUBCTA, s.supplierAccount CONTRA, ROUND(tcLink.rate/100*SUM(it.taxableBase) + 0.0001,2) EUROHABER, @@ -51836,32 +51097,19 @@ BEGIN FROM supplier s JOIN invoiceOut io ON io.companyFk = s.id WHERE io.id = vInvoice; - /* - SELECT IF( - c.isEqualizated - AND c.countryFk = vSpainCountryCode - AND i.taxAreaFk = 'NATIONAL', - 'EQU', - i.taxAreaFk - ) - INTO vTaxArea - FROM invoiceOutSerial i - JOIN invoiceOut io ON io.serial = i.code - JOIN client c ON c.id = io.clientFk - WHERE io.id = vInvoice; - */ - SELECT IF(a.isEqualizated + + SELECT IF(a.isEqualizated AND c.countryFk = vSpainCountryCode AND i.taxAreaFk = 'NATIONAL', 'EQU', i.taxAreaFk) INTO vTaxArea FROM invoiceOutSerial i - JOIN invoiceOut io ON io.serial = i.code + JOIN invoiceOut io JOIN ticket t ON t.refFk = io.ref JOIN address a ON a.id = t.addressFk JOIN client c ON c.id = t.clientFk - WHERE io.id = vInvoice + WHERE io.id = vInvoice AND i.code = invoiceSerial(io.clientFk,io.companyFk,'R') LIMIT 1; DROP TEMPORARY TABLE IF EXISTS ticketToInvoice; @@ -51964,6 +51212,224 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `invoiceOutBooking`(IN vInvoice INT) BEGIN +/* Asienta la factura emitida +* +* param vInvoice factura_id +*/ + + DECLARE vBookNumber INT; + DECLARE vExpenceConcept VARCHAR(50); + DECLARE isUEENotSpain INT DEFAULT 1; + DECLARE vSpain INT DEFAULT 1; + DECLARE vOldBookNumber INT; + + SELECT ASIEN + INTO vOldBookNumber + FROM vn2008.XDiario x + JOIN vn.invoiceOut io ON io.id = vInvoice + WHERE x.SERIE = io.serial + AND x.FACTURA = RIGHT(io.ref, LENGTH(io.ref) - 1) + LIMIT 1; + + DELETE + FROM vn2008.XDiario + WHERE ASIEN = vOldBookNumber; + + DROP TEMPORARY TABLE IF EXISTS rs; + CREATE TEMPORARY TABLE rs + SELECT + c.accountingAccount AS clientBookingAccount, + io.amount as totalAmount, + CONCAT('n/fra ', io.ref) as simpleConcept, + CONCAT('n/fra ', io.ref, ' ', c.name) as Concept, + io.serial AS SERIE, + io.issued AS FECHA_EX, + opDate.FECHA_OP, + io.issued AS FECHA, + 1 AS NFACTICK, + IF(ic.correctingFk,'D','') AS TIPOOPE, + io.cplusTrascendency477Fk AS TIPOCLAVE, + io.cplusTaxBreakFk AS TIPOEXENCI, + io.cplusSubjectOpFk AS TIPONOSUJE, + io.cplusInvoiceType477Fk AS TIPOFACT, + ic.cplusRectificationTypeFk AS TIPORECTIF, + io.companyFk, + RIGHT(io.ref, LENGTH(io.ref) - 1) AS invoiceNum, + IF(ct.politicalCountryFk = vSpain, 1, IF(ct.CEE = isUEENotSpain,2,4)) AS TERIDNIF, + CONCAT(IF(ct.CEE = isUEENotSpain,ct.code,''),c.fi) AS TERNIF, + c.socialName AS TERNOM, + ior.serial AS SERIE_RT, + RIGHT(ior.ref, LENGTH(ior.ref) - 1) AS FACTU_RT, + ior.issued AS FECHA_RT, + IF(ior.id,TRUE,FALSE) AS RECTIFICA + + FROM invoiceOut io + JOIN ( + SELECT GREATEST(MAX(shipped), TIMESTAMPADD(DAY,-15,io.issued)) as FECHA_OP + FROM ticket t + JOIN invoiceOut io ON io.ref = t.refFk + WHERE io.id = vInvoice ) opDate + JOIN invoiceOutSerial ios ON ios.code = io.serial + JOIN client c ON c.id = io.clientFk + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN invoiceCorrection ic ON ic.correctingFk = io.id + LEFT JOIN invoiceOut ior ON ior.id = ic.correctedFk + WHERE io.id = vInvoice; + + SELECT MAX(ASIEN) + 1 + INTO vBookNumber + FROM vn2008.XDiario; + + -- Linea del cliente + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + EURODEBE, + CONCEPTO, + FECHA_EX, + FECHA_OP, + empresa_id + ) + SELECT + vBookNumber AS ASIEN, + rs.FECHA, + rs.clientBookingAccount AS SUBCTA, + rs.totalAmount AS EURODEBE, + rs.simpleConcept AS CONCEPTO, + rs.FECHA_EX, + rs.FECHA_OP, + rs.companyFk AS empresa_id + FROM rs; + + -- Lineas de gasto + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EUROHABER, + CONCEPTO, + FECHA_EX, + FECHA_OP, + empresa_id + ) + SELECT + vBookNumber AS ASIEN, + rs.FECHA, + ioe.expenceFk AS SUBCTA, + rs.clientBookingAccount AS CONTRA, + ioe.amount AS EUROHABER, + rs.Concept AS CONCEPTO, + rs.FECHA_EX, + rs.FECHA_OP, + rs.companyFk AS empresa_id + FROM rs + JOIN invoiceOutExpence ioe + WHERE ioe.invoiceOutFk = vInvoice; + + SELECT GROUP_CONCAT(`name` SEPARATOR ',') + INTO vExpenceConcept + FROM expence e + JOIN invoiceOutExpence ioe ON ioe.expenceFk = e.id + WHERE ioe.invoiceOutFk = vInvoice; + + -- Lineas de IVA + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EUROHABER, + BASEEURO, + CONCEPTO, + FACTURA, + IVA, + RECEQUIV, + AUXILIAR, + SERIE, + SERIE_RT, + FACTU_RT, + RECTIFICA, + FECHA_RT, + FECHA_OP, + FECHA_EX, + TIPOOPE, + NFACTICK, + TERIDNIF, + TERNIF, + TERNOM, + L340, + TIPOCLAVE, + TIPOEXENCI, + TIPONOSUJE, + TIPOFACT, + TIPORECTIF, + empresa_id + ) + SELECT + vBookNumber AS ASIEN, + rs.FECHA, + iot.pgcFk AS SUBCTA, + rs.clientBookingAccount AS CONTRA, + iot.vat AS EUROHABER, + iot.taxableBase AS BASEEURO, + CONCAT(vExpenceConcept,' : ',rs.Concept) AS CONCEPTO, + rs.invoiceNum AS FACTURA, + IF(pe2.equFk,0,pgc.rate) AS IVA, + IF(pe2.equFk,0,pgce.rate) AS RECEQUIV, + IF(pgc.mod347,'','*') AS AUXILIAR, + rs.SERIE, + rs.SERIE_RT, + rs.FACTU_RT, + rs.RECTIFICA, + rs.FECHA_RT, + rs.FECHA_OP, + rs.FECHA_EX, + rs.TIPOOPE, + rs.NFACTICK, + rs.TERIDNIF, + rs.TERNIF, + rs.TERNOM, + pgc.mod340 AS L340, + pgc.cplusTrascendency477Fk AS TIPOCLAVE, + pgc.cplusTaxBreakFk as TIPOEXENCI, + rs.TIPONOSUJE, + rs.TIPOFACT, + rs.TIPORECTIF, + rs.companyFk AS empresa_id + FROM rs + JOIN invoiceOutTax iot + JOIN pgc ON pgc.code = iot.pgcFk + LEFT JOIN pgcEqu pe ON pe.vatFk = iot.pgcFk -- --------------- Comprueba si la linea es de iva con rec.equiv. asociado + LEFT JOIN pgc pgce ON pgce.code = pe.equFk + LEFT JOIN pgcEqu pe2 ON pe2.equFk = iot.pgcFk -- --------------- Comprueba si la linea es de rec.equiv. + WHERE iot.invoiceOutFk = vInvoice; + + UPDATE invoiceOut + SET booked = CURDATE() + WHERE id = vInvoice; + + +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 DROP PROCEDURE IF EXISTS `invoiceOutBookingkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceOutBookingkk`(IN vInvoice INT) +BEGIN + /* Asienta la factura emitida * * param vInvoice factura_id @@ -52222,6 +51688,33 @@ BEGIN SELECT CONCAT(vContador, ' total') AS FACTURAS_ASENTADAS; +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 DROP PROCEDURE IF EXISTS `invoiceOutDelete` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceOutDelete`(vRef VARCHAR(15)) +BEGIN + + UPDATE ticket + SET refFk = NULL + WHERE refFk = vRef; + + DELETE + FROM invoiceOut + WHERE ref = vRef; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52377,6 +51870,164 @@ CREATE DEFINER=`root`@`%` PROCEDURE `invoiceOutMake`( OUT vNewInvoiceId INT) BEGIN +/* Creación de facturas emitidas. +* REQUIERE previamente tabla ticketToInvoice. +* +* @param vSerial, vInvoiceDate, vCompany, vClient +* +* @return vNewInvoiceId +*/ + + DECLARE vSpainCountryCode INT DEFAULT 1; + DECLARE vIsAnySaleToInvoice BOOL; + DECLARE vCountry TINYINT DEFAULT 1; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT vn.getWorker(); + DECLARE vCompany INT; + DECLARE vClient INT; + DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1; + DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6; + DECLARE vCplusSimplifiedInvoiceTypeFk INT DEFAULT 2; + DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R'; + DECLARE vSimplifiedSerial VARCHAR(1) DEFAULT 'S'; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + ROLLBACK; + RESIGNAL; + END; + + SET vInvoiceDate = IFNULL(vInvoiceDate,CURDATE()); + + SELECT t.clientFk, t.companyFk + INTO vClient, vCompany + FROM ticketToInvoice tt + JOIN ticket t ON t.id = tt.id + LIMIT 1; + + START TRANSACTION; + + -- Elimina tickets sense moviments +/* UPDATE ticket t + JOIN ticketToInvoice ti ON ti.id = t.id + LEFT JOIN sale s ON s.ticketFk = ti.id + LEFT JOIN expedition e ON e.ticketFk = t.id + LEFT JOIN ticketPackaging tp ON tp.ticketFk = t.id + SET t.shipped = '2000-02-01 00:00:00' + WHERE s.ticketFk IS NULL AND e.ticketFk IS NULL AND e.ticketFk IS NULL; +*/ + -- Eliminem de ticketToInvoice els tickets que no han de ser facturats + DELETE ti.* + FROM ticketToInvoice ti + JOIN ticket t ON t.id = ti.id + JOIN client c ON c.id = t.clientFk + WHERE YEAR(t.shipped) < 2001 + OR c.isTaxDataChecked = FALSE; + + SELECT SUM(quantity * price * (100 - discount)/100) + INTO vIsAnySaleToInvoice + FROM sale s + JOIN ticketToInvoice t on t.id = s.ticketFk; + + IF vIsAnySaleToInvoice THEN + + -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial + -- el trigger añade el siguiente Id_Factura correspondiente a la vSerial + INSERT INTO invoiceOut + ( + ref, + serial, + issued, + clientFk, + dued, + companyFk, + cplusInvoiceType477Fk + ) + SELECT + 1, + vSerial, + vInvoiceDate, + vClient, + getDueDate(vInvoiceDate, dueDay), + vCompany, + IF(vSerial = vCorrectingSerial, + vCplusCorrectingInvoiceTypeFk, + IF(vSerial = vSimplifiedSerial, + vCplusSimplifiedInvoiceTypeFk, + vCplusStandardInvoiceTypeFk)) + FROM client + WHERE id = vClient; + + + SET vNewInvoiceId = LAST_INSERT_ID(); + + SELECT ref + INTO vNewRef + FROM invoiceOut + WHERE id = vNewInvoiceId; + + UPDATE ticket t + JOIN ticketToInvoice ti ON ti.id = t.id + SET t.refFk = vNewRef; + + DROP TEMPORARY TABLE IF EXISTS tmp.updateInter; + CREATE TEMPORARY TABLE tmp.updateInter ENGINE = MEMORY + SELECT s.id,ti.id ticket_id,vWorker Id_Trabajador + FROM ticketToInvoice ti + JOIN vn.ticketState ts ON ti.id = ts.ticket + JOIN state s + WHERE IFNULL(ts.alertLevel,0) < 3 and s.`code` = vn.getAlert3State(ti.id); + + INSERT INTO vncontrol.inter(state_id,Id_Ticket,Id_Trabajador) + SELECT * FROM tmp.updateInter; + + + INSERT INTO ticketLog (action, userFk,originFk, description) + SELECT 'UPDATE',account.userGetId(),ti.id, CONCAT('Crea factura ',vNewRef) + FROM ticketToInvoice ti; + + CALL invoiceExpenceMake(vNewInvoiceId); + CALL invoiceTaxMake(vNewInvoiceId,vCountry); + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) AS total + FROM invoiceOutExpence + WHERE invoiceOutFk = vNewInvoiceId + ) base + JOIN ( + SELECT SUM(vat) AS total + FROM invoiceOutTax + WHERE invoiceOutFk = vNewInvoiceId + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vNewInvoiceId; + + END IF; + + DROP TEMPORARY TABLE `ticketToInvoice`; + COMMIT; +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 DROP PROCEDURE IF EXISTS `invoiceOutMakekk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceOutMakekk`( + vSerial VARCHAR(255), + vInvoiceDate DATETIME, + OUT vNewInvoiceId INT) +BEGIN + /* Creación de facturas emitidas. * REQUIERE previamente tabla ticketToInvoice. * @@ -52393,10 +52044,15 @@ BEGIN DECLARE vWorker INT DEFAULT vn.getWorker(); DECLARE vCompany INT; DECLARE vClient INT; - DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1; + DECLARE vCplusStandardInvoiceTypeFk INT DEFAULT 1; DECLARE vCplusCorrectingInvoiceTypeFk INT DEFAULT 6; DECLARE vCorrectingSerial VARCHAR(1) DEFAULT 'R'; + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + ROLLBACK; + RESIGNAL; + END; + SET vInvoiceDate = IFNULL(vInvoiceDate,CURDATE()); SELECT t.clientFk, t.companyFk @@ -52421,37 +52077,32 @@ BEGIN JOIN ticket t ON t.id = tti.id JOIN address a ON a.id = t.addressFk JOIN client c ON c.id = t.clientFk - WHERE i.code = vSerial + WHERE i.code = invoiceSerial(t.clientFk,t.companyFk,'R') LIMIT 1; - - INSERT INTO dailyTaskLog(state) VALUES('invoiceOutMake 1: START'); START TRANSACTION; -- Elimina tickets sense moviments - UPDATE ticket t +/* UPDATE ticket t JOIN ticketToInvoice ti ON ti.id = t.id LEFT JOIN sale s ON s.ticketFk = ti.id + LEFT JOIN expedition e ON e.ticketFk = t.id + LEFT JOIN ticketPackaging tp ON tp.ticketFk = t.id SET t.shipped = '2000-02-01 00:00:00' - WHERE s.id IS NULL; - - INSERT INTO dailyTaskLog(state) VALUES('invoiceOutMake 1.1'); - - -- Eliminem els tickets que no han de ser facturats + WHERE s.ticketFk IS NULL AND e.ticketFk IS NULL AND e.ticketFk IS NULL; +*/ + -- Eliminem de ticketToInvoice els tickets que no han de ser facturats DELETE ti.* FROM ticketToInvoice ti JOIN ticket t ON t.id = ti.id JOIN client c ON c.id = t.clientFk WHERE YEAR(t.shipped) < 2001 OR c.isTaxDataChecked = FALSE; - INSERT INTO dailyTaskLog(state) VALUES('invoiceOutMake 1.2'); SELECT SUM(quantity * price * (100 - discount)/100) INTO vIsAnySaleToInvoice FROM sale s JOIN ticketToInvoice t on t.id = s.ticketFk; - - INSERT INTO dailyTaskLog(state) VALUES('invoiceOutMake 1.3'); IF vIsAnySaleToInvoice THEN @@ -52501,56 +52152,30 @@ BEGIN INSERT INTO vncontrol.inter(state_id,Id_Ticket,Id_Trabajador) SELECT * FROM tmp.updateInter; - INSERT INTO logTicket (action, userFk,originFk, description) - SELECT 'UPDATE',account.userGetId(),ti.id, CONCAT('CREA FACTURA ',vNewRef) - FROM ticketToInvoice ti; - CALL invoiceExpenceMake(vNewInvoiceId); - CALL invoiceTaxMake(vNewInvoiceId,vCountry,vTaxArea); - - UPDATE invoiceOut io - JOIN ( - SELECT SUM(amount) AS total - FROM invoiceOutExpence - WHERE invoiceOutFk = vNewInvoiceId - ) base - JOIN ( - SELECT SUM(vat) AS total - FROM invoiceOutTax - WHERE invoiceOutFk = vNewInvoiceId - ) vat - SET io.amount = base.total + vat.total - WHERE io.id = vNewInvoiceId; - INSERT INTO dailyTaskLog(state) VALUES('invoiceOutMake 2: START'); - -- Retrocompatibilidad. Borrar al cambiar el informe de facturas - UPDATE vn2008.Facturas f - JOIN invoiceOutTax iot ON iot.invoiceOutFk = f.factura_id - SET f.BI16 = iot.taxableBase, f.IVA16 = iot.vat - WHERE f.factura_id = vNewInvoiceId - AND iot.pgcFk IN ('4770000021' ,'4770000215', '4770000002','4771000000','4770000000','4770000020'); + INSERT INTO ticketLog (action, userFk,originFk, description) + SELECT 'UPDATE',account.userGetId(),ti.id, CONCAT('Crea factura ',vNewRef) + FROM ticketToInvoice ti; - UPDATE vn2008.Facturas f - JOIN invoiceOutTax iot ON iot.invoiceOutFk = f.factura_id - SET f.RE4 = iot.vat - WHERE f.factura_id = vNewInvoiceId - AND iot.pgcFk = '4770000521'; - - UPDATE vn2008.Facturas f - JOIN invoiceOutTax iot ON iot.invoiceOutFk = f.factura_id - SET f.BI7 = iot.taxableBase, f.IVA7 = iot.vat - WHERE f.factura_id = vNewInvoiceId - AND iot.pgcFk IN ('4770000010' ,'4770000101'); - - UPDATE vn2008.Facturas f - JOIN invoiceOutTax iot ON iot.invoiceOutFk = f.factura_id - SET f.RE1 = iot.vat - WHERE f.factura_id = vNewInvoiceId - AND iot.pgcFk = '4770000110'; + CALL invoiceExpenceMake(vNewInvoiceId); + CALL invoiceTaxMake(vNewInvoiceId,vCountry,vTaxArea); + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) AS total + FROM invoiceOutExpence + WHERE invoiceOutFk = vNewInvoiceId + ) base + JOIN ( + SELECT SUM(vat) AS total + FROM invoiceOutTax + WHERE invoiceOutFk = vNewInvoiceId + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vNewInvoiceId; + END IF; - - INSERT INTO dailyTaskLog(state) VALUES('invoiceOutMake 3: END'); - DROP TEMPORARY TABLE `ticketToInvoice`; COMMIT; END ;; @@ -52660,7 +52285,54 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `invoiceTaxMake`(IN vInvoice INT, IN vCountry INT, IN vTaxArea VARCHAR(15)) +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceTaxMake`(IN vInvoice INT, IN vCountry INT) +BEGIN + + DELETE FROM invoiceOutTax + WHERE invoiceOutFk = vInvoice; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM ticketToInvoice; + + CALL ticketGetTax(); + + INSERT INTO invoiceOutTax( + invoiceOutFk, + pgcFk, + taxableBase, + vat + ) + SELECT vInvoice, + pgcFk, + SUM(taxableBase), + SUM(tax) + FROM tmp.ticketTax + GROUP BY pgcFk; + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketAmount; +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 DROP PROCEDURE IF EXISTS `invoiceTaxMakekk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `invoiceTaxMakekk`(IN vInvoice INT, IN vCountry INT, IN vTaxArea VARCHAR(15)) BEGIN /* Inserta los registros de iva de la factura emitida * REQUIERE tabla ticketToInvoice @@ -52879,25 +52551,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `logAdd`(vOriginFk INT, vActionCode VARCHAR(45), vTypeCode VARCHAR(45), vDescription TEXT) +CREATE DEFINER=`root`@`%` PROCEDURE `logAdd`(vOriginFk INT, vActionCode VARCHAR(45), vEntity VARCHAR(45), vDescription TEXT) BEGIN /** * Guarda las acciones realizadas por el usuario * * @param vOriginFk Id del registro de origen * @param vActionCode Código de la acción {insert | delete | update} - * @param vTypeCode Código que referencia a la tabla. + * @param vEntity Nombre que hace referencia a la tabla. * @param descripcion Descripción de la acción realizada por el usuario */ DECLARE vTableName VARCHAR(45); - SELECT logTableName INTO vTableName - FROM vn.logType - WHERE `code` = vTypeCode; - - IF ISNULL(vTableName) THEN - CALL util.throw('CODE_NOT_FOUND'); - END IF; + SET vTableName = CONCAT(vEntity, 'Log'); SET @qryLog := CONCAT( 'INSERT INTO ', vTableName, ' (originFk, userFk, action, description)', @@ -52922,23 +52588,17 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `logShow`(vOriginFk INT, vTypeCode VARCHAR(45)) +CREATE DEFINER=`root`@`%` PROCEDURE `logShow`(vOriginFk INT, vEntity VARCHAR(45)) BEGIN /** * Muestra las acciones realizadas por el usuario * * @param vOriginFk Id del registro de origen - * @param vTypeCode Código que referencia a la tabla. + * @param vEntity Nombre que hace referencia a la tabla. */ DECLARE vTableName VARCHAR(45); - SELECT logTableName INTO vTableName - FROM vn.logType - WHERE `code` = vTypeCode; - - IF ISNULL(vTableName) THEN - CALL util.throw('CODE_NOT_FOUND'); - END IF; + SET vTableName = CONCAT(vEntity, 'Log'); SET @qryLog := CONCAT( 'SELECT ot.id, ot.originFk, ot.userFk, u.name, ot.action, ot.creationDate, ot.description FROM ', vTableName, ' AS ot', @@ -53033,8 +52693,8 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS vn2008.Tickets_to_fusion; - -- He usado el sql_query porque da error la variable strId_Tickets puesta dentro del IN() - CALL hedera.sql_query(sql_printf(' + -- He usado el util.exec porque da error la variable strId_Tickets puesta dentro del IN() + CALL util.exec(sql_printf(' CREATE TEMPORARY TABLE vn2008.Tickets_to_fusion SELECT Id_Ticket, Localizacion FROM vn2008.Tickets T @@ -53053,7 +52713,11 @@ BEGIN UPDATE vn2008.expeditions M JOIN vn2008.Tickets_to_fusion t ON t.Id_Ticket = M.ticket_id SET M.ticket_id = vMainTicket; - + + UPDATE vn.ticketPackaging tp + JOIN vn2008.Tickets_to_fusion t ON t.Id_Ticket = tp.ticketFk + SET tp.ticketFk = vMainTicket; + UPDATE vn2008.Tickets SET Bultos = (SELECT COUNT(*) FROM vn2008.expeditions WHERE ticket_id = vMainTicket AND EsBulto) WHERE Id_Ticket = vMainTicket; @@ -53101,6 +52765,183 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `nestAdd` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nestAdd`(vScheme VARCHAR(45), vTable VARCHAR(45), vParentFk INT, vChild VARCHAR(45)) +BEGIN + DECLARE vSql TEXT; + + -- Check parent childs + SET vSql = sql_printf(' + SELECT COUNT(c.id) INTO @childs + FROM %t.%t p + LEFT JOIN %t.%t c ON c.lft BETWEEN p.lft AND p.rgt AND c.id != %v + WHERE p.id = %v', + vScheme, vTable, vScheme, vTable, vParentFk, vParentFk); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + + -- Select left from last child + IF @childs = 0 THEN + SET vSql = sql_printf('SELECT lft INTO @vLeft FROM %t.%t WHERE id = %v', vScheme, vTable, vParentFk); + SET @qrySql := vSql; + ELSE + SET vSql = sql_printf(' + SELECT c.rgt INTO @vLeft + FROM %t.%t p + JOIN %t.%t c ON c.lft BETWEEN p.lft AND p.rgt + WHERE p.id = %v + ORDER BY c.lft + DESC LIMIT 1', + vScheme, vTable, vScheme, vTable, vParentFk); + SET @qrySql := vSql; + END IF; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + + -- Update right + SET vSql = sql_printf('UPDATE %t.%t SET rgt = rgt + 2 WHERE rgt > %v ORDER BY rgt DESC', vScheme, vTable, @vLeft); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + + SET vSql = sql_printf('UPDATE %t.%t SET lft = lft + 2 WHERE lft > %v ORDER BY lft DESC', vScheme, vTable, @vLeft); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + + -- Escape character + SET vChild = REPLACE(vChild, "'", "\\'"); + + -- Add child + SET vSql = sql_printf('INSERT INTO %t.%t (name, lft, rgt) VALUES (%v, %v, %v)', vScheme, vTable, vChild, @vLeft + 1, @vLeft + 2); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +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 DROP PROCEDURE IF EXISTS `nestLeave` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nestLeave`(vScheme VARCHAR(45), vTable VARCHAR(45), vParentFk INT) +BEGIN + DECLARE vSql TEXT; + + DROP TEMPORARY TABLE IF EXISTS tmp.tree; + + SET vSql = sql_printf(' + CREATE TEMPORARY TABLE tmp.tree ENGINE = MEMORY + SELECT + node.id, + node.name, + node.lft, + node.rgt, + node.depth, + node.sons + FROM + %t.%t AS node, + %t.%t AS parent + WHERE + node.lft BETWEEN parent.lft AND parent.rgt + AND node.depth = parent.depth + 1 + AND parent.id = %v + GROUP BY node.id + ORDER BY node.lft', + vScheme, vTable, vScheme, vTable, vParentFk); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +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 DROP PROCEDURE IF EXISTS `nestTree` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nestTree`( + vSourceSchema VARCHAR(45), + vSourceTable VARCHAR(45), + vDestinationSchema VARCHAR(45), + vDestinationTable VARCHAR(45)) +BEGIN + DECLARE vSql TEXT; + + + SET vSql = sql_printf('DROP TABLE IF EXISTS %t.%t', vDestinationSchema, vDestinationTable); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + + SET vSql = sql_printf(' + CREATE TABLE %t.%t + SELECT + node.id, + CONCAT( REPEAT(" ", 5 * (COUNT(parent.id) - 1)),UCASE(node.name)) name, + node.lft, + node.rgt, + COUNT(parent.id) - 1 depth, + CAST((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons + FROM + %t.%t AS node, + %t.%t AS parent + WHERE node.lft BETWEEN parent.lft AND parent.rgt + GROUP BY node.id + ORDER BY node.lft', + vDestinationSchema, vDestinationTable, vSourceSchema, vSourceTable, vSourceSchema, vSourceTable); + SET @qrySql := vSql; + + PREPARE stmt FROM @qrySql; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +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 DROP PROCEDURE IF EXISTS `noticeSend` */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -53174,6 +53015,129 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `packageInvoicing` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `packageInvoicing`( + IN vClient INT, + IN vDate DATE, + IN vCompany INT, + IN vIsAllInvoiceable BOOLEAN, + OUT vNewTicket INT(11) + ) +BEGIN + + DECLARE vGraceDays INT; + DECLARE vDateStart DATE DEFAULT '2017-11-21'; + DECLARE vIsInvoiceable BOOLEAN; + DECLARE vWarehouse INT DEFAULT 13; + DECLARE vAgenciaEmbalajes INT DEFAULT 628; + DECLARE vComponentCost INT DEFAULT 28; + DECLARE vGraceDate DATE; + + SET vGraceDays = IF(vIsAllInvoiceable,0,30); + SET vGraceDate = TIMESTAMPADD(DAY, - vGraceDays, vDate); + + /* Clientes especiales: + 3240 MADEFLOR + 992 JAVIER FELIU + */ + + IF vClient IN (992, 3240) THEN + + SET vGraceDays = 365; + + END IF; + + /* Fin clientes especiales */ + + + DROP TEMPORARY TABLE IF EXISTS tmp.packageToInvoice; + + CREATE TEMPORARY TABLE tmp.packageToInvoice + SELECT p.itemFk, + tp.packagingFk, + IF(tp.quantity < 0 OR t.shipped < vGraceDate, tp.quantity, 0) quantity, + tp.ticketFk, + p.price + FROM ticketPackaging tp + JOIN package p ON p.id = tp.packagingFk + JOIN ticket t ON t.id = tp.ticketFk + WHERE t.shipped BETWEEN vDateStart AND vDate + AND t.clientFk = vClient; + + DROP TEMPORARY TABLE IF EXISTS tmp.packageToInvoicePositives; + + CREATE TEMPORARY TABLE tmp.packageToInvoicePositives + SELECT itemFk, sum(quantity) as totalQuantity + FROM tmp.packageToInvoice + GROUP BY itemFk + HAVING totalQuantity > 0; + + SELECT GREATEST(COUNT(*),vIsAllInvoiceable) + INTO vIsInvoiceable + FROM tmp.packageToInvoicePositives; + + IF vIsInvoiceable THEN + + CALL vn.ticketCreate(vClient, vDate, vWarehouse, vCompany, 0, vAgenciaEmbalajes, 0, vDate, vNewTicket); + + INSERT INTO ticketPackaging( + ticketFk, + packagingFk, + quantity, + pvp) + SELECT vNewTicket, + pti.packagingFk, + - SUM(pti.quantity) AS totalQuantity, + pti.price + FROM tmp.packageToInvoice pti + LEFT JOIN tmp.packageToInvoicePositives ptip ON pti.itemFk = ptip.itemFk + WHERE ptip.itemFK IS NOT NULL + OR vIsAllInvoiceable + GROUP BY packagingFk + HAVING totalQuantity; + + INSERT INTO sale( + ticketFk, + itemFk, + concept, + quantity, + price + ) + SELECT vNewTicket, + pti.itemFk, + i.name as concept, + sum(pti.quantity) as totalQuantity, + pti.price + FROM tmp.packageToInvoice pti + JOIN item i ON i.id = pti.itemFk + LEFT JOIN tmp.packageToInvoicePositives ptip ON pti.itemFk = ptip.itemFk + WHERE ptip.itemFK IS NOT NULL + OR vIsAllInvoiceable + GROUP BY pti.itemFk + HAVING totalQuantity; + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT id, vComponentCost, price + FROM sale + WHERE ticketFk = vNewTicket; + + 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 DROP PROCEDURE IF EXISTS `printTrolleyLabel` */; ALTER DATABASE `vn` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -53244,7 +53208,7 @@ BEGIN DECLARE vAddress MEDIUMINT; DECLARE vRefundAgencyMode INT DEFAULT 23; - SELECT customer, TIMESTAMPADD(DAY, 1,shipment), warehouse, company, address + SELECT clientFk, TIMESTAMPADD(DAY, 1,shipped), warehouseFk, companyFk, addressFk INTO vCustomer, vNewDate, vWarehouse, vCompany, vAddress FROM ticket WHERE id = vMainTicket; @@ -53255,6 +53219,240 @@ BEGIN SELECT vNewTicket, Id_Article, - Cantidad, Concepte, Preu, Descuento, TRUE FROM vn2008.Movimientos WHERE Id_Ticket = vMainTicket; SELECT vNewTicket; +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 DROP PROCEDURE IF EXISTS `routeGateAsign` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `routeGateAsign`(vDevice VARCHAR(30), vRouteFk INT) +BEGIN + + UPDATE routeGate + SET displayText = NULL, + routeFk = NULL, + freeTickets = NULL, + expeditions = NULL, + scanned = NULL, + flag = NULL, + pallets = NULL, + lastScanned = NULL + WHERE routeFk = vRouteFk; + + UPDATE routeGate + SET routeFk = vRouteFk + WHERE deviceId = vDevice COLLATE utf8_general_ci; + +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 DROP PROCEDURE IF EXISTS `routeGateUpdate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `routeGateUpdate`() +BEGIN + + UPDATE vn.routeGate rg + LEFT JOIN vn.routesControl rc ON rg.routeFk = rc.routeFk + LEFT JOIN vn.route r ON r.id = rg.routeFk + LEFT JOIN vn2008.Agencias a ON a.Id_Agencia = r.agencyModeFk + LEFT JOIN + ( + SELECT Id_Ruta, count(*) AS pedidosLibres + FROM vn2008.Tickets t + JOIN vn2008.Tickets_state ts ON t.Id_Ticket = ts.Id_Ticket + JOIN vncontrol.inter i ON i.inter_id = ts.inter_id + JOIN vn2008.state s ON i.state_id = s.id AND s.alert_level = 0 + WHERE t.Fecha BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND Id_Ruta + GROUP BY Id_Ruta + ) t ON t.Id_Ruta = rg.routeFk + SET rg.scanned = rc.scanned, + rg.expeditions = rc.expeditions, + rg.flag = a.flag, + rg.freeTickets = t.pedidosLibres, + rg.pallets = rc.pallets, + rg.lastScanned = rc.lastScanned, + rg.displayText = IF(rg.routeFk is null, rg.displayText, rg.routeFk MOD 1000); + + +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 DROP PROCEDURE IF EXISTS `saleSplit` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `saleSplit`(IN vIdMovement BIGINT, IN vQuantity int) +BEGIN + DECLARE vId INT; + DECLARE vCreated DATE; + DECLARE vWarehouseId INT; + DECLARE vCompanyId INT; + DECLARE vAddressId INT; + DECLARE vAgencyMode INT; + DECLARE vNewTicketId BIGINT; + DECLARE vNewSale BIGINT; + DECLARE vLanded DATE; + DECLARE vStarted DATETIME; + DECLARE vEnded DATETIME; + DECLARE vCurrentTicket INT; + + + + SELECT clientFk + , shipped + , warehouseFk + , companyFk + , addressFk + , AgencyModeFk + , Landed + , t.id + + INTO vId + , vCreated + , vWarehouseId + , vCompanyId + , vAddressId + , vAgencyMode + , vLanded + , vCurrentTicket + FROM ticket t + JOIN sale m on t.id = m.ticketFk + WHERE m.id = vIdMovement; + + -- Busca un ticket existente que coincida con los parametros del nuevo pedido + + SET vStarted = TIMESTAMP(vCreated); + SET vEnded = TIMESTAMP(vCreated, '23:59:59'); + + SELECT id INTO vNewTicketId + FROM ticket t + JOIN ticketState ts on t.id = ts.ticketFk + WHERE vAddressId = t.addressFk + AND vWarehouseId = t.warehouseFk + AND vAgencyMode = t.AgencyModeFk + AND vLanded <=> t.landed + AND t.shipment BETWEEN vStarted AND vEnded -- uso BETWEEN para aprovechar el indice + AND t.refFk IS NULL + AND ts.alertLevel = 0 + AND t.clientFk <> 1118 + AND t.id <> vCurrentTicket + LIMIT 1; + + IF vNewTicketId IS NULL THEN + Call vn.ticketCreate( vId + , vCreated + , vWarehouseId + , vCompanyId + , vAddressId + , vAgencyMode + , NULL + , vLanded + , vNewTicketId); + + CALL vn2008.bionic_calc_ticket(vNewTicketId); + ELSE + UPDATE ticket SET landed = vLanded WHERE id = vNewTicketId; + END IF; + + INSERT INTO vncontrol.inter(Id_Ticket, state_id) + SELECT vNewTicketId, s.id + FROM state s + WHERE s.code = 'FIXING'; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vNewTicketId, itemFk, Concept, vQuantity, price, discount + FROM sale + WHERE id = vIdMovement; + + SELECT LAST_INSERT_ID() INTO vNewSale; + + INSERT INTO saleComponent(saleFk, componentFk, `value`) + SELECT vNewSale, componentFk, `value` + FROM saleComponent + WHERE saleFk = vIdMovement; +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 DROP PROCEDURE IF EXISTS `scanTreeCreate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `scanTreeCreate`() +BEGIN + + CALL vn.nestTree( 'vn2008', + 'scan', + 'vn2008', + 'scanTree'); + + ALTER TABLE vn2008.scanTree + ADD COLUMN lastScanned DATETIME NULL, + ADD COLUMN routeCount INT NULL, + ADD COLUMN minRoute INT, + ADD COLUMN maxRoute INT, + ADD COLUMN scanned INT; + + UPDATE vn2008.scanTree st + JOIN ( + SELECT sl.scan_id, + MAX(sl.odbc_date) lastScanned, + COUNT(DISTINCT t.routeFk) routeCount, + MIN(t.routeFk) mod 1000 as minRoute, + MAX(t.routeFk) mod 1000 as maxRoute, + COUNT(sl.scan_line_id) as scanned + FROM vn2008.scan_line sl + JOIN vn.expedition e ON e.id = sl.`code` + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.routeFk + GROUP BY sl.scan_id + ) rs ON rs.scan_id = st.id + SET st.lastScanned = rs.lastScanned, + st.routeCount = rs.routeCount, + st.minRoute = rs.minRoute, + st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL), + st.scanned = rs.scanned; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53347,7 +53545,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `stockBuyedByWorker` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -53366,7 +53563,7 @@ BEGIN SELECT Volumen INTO vVolume FROM vn2008.Cubos WHERE Id_Cubo = 'cc' LIMIT 1; - SELECT c.Id_Entrada, a.Id_Article, a.Article, c.Cantidad, (0.6 * ( amount / c.packing ) * vn2008.cm3(Id_Compra))/vVolume buyed + SELECT c.Id_Entrada, a.Id_Article, a.Article, i.amount Cantidad, (0.6 * ( i.amount / c.packing ) * vn2008.cm3(Id_Compra))/vVolume buyed FROM tmp_item i JOIN vn2008.Articles a ON a.Id_Article = i.item_id JOIN vn2008.Tipos t ON a.tipo_id = t.tipo_id @@ -53382,9 +53579,42 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `stockBuyedByWorkerTest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `stockBuyedByWorkerTest`(vDate DATE, vWorker INT) +BEGIN + + DECLARE vVolume DECIMAL(10,2); + DECLARE vWarehouse INT DEFAULT 7; + CALL stockTraslationTest(vDate); + + SELECT Volumen INTO vVolume FROM vn2008.Cubos WHERE Id_Cubo = 'cc' LIMIT 1; + + SELECT c.Id_Entrada, a.Id_Article, a.Article, i.amount Cantidad, (0.6 * ( i.amount / c.packing ) * vn2008.cm3(Id_Compra))/vVolume buyed + FROM tmp.item i + JOIN vn2008.Articles a ON a.Id_Article = i.item_id + JOIN vn2008.Tipos t ON a.tipo_id = t.tipo_id + JOIN vn2008.reinos r ON r.id = t.reino_id + JOIN vn2008.Trabajadores tr ON tr.Id_Trabajador = t.Id_Trabajador + JOIN vn2008.t_item_last_buy ilb ON ilb.item_id = a.Id_Article AND ilb.warehouse_id = vWarehouse + JOIN vn2008.Compres c ON c.Id_compra = ilb.buy_id + WHERE r.display <> 0 AND tr.user_id = vWorker; + DROP TEMPORARY TABLE IF EXISTS tmp_item; +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 DROP PROCEDURE IF EXISTS `stockTraslation` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -53411,7 +53641,7 @@ BEGIN (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY SELECT item_id, SUM(amount) amount FROM vn2008.item_entry_in - WHERE dat = vDate + WHERE dat = vDate and vDate >= CURDATE() AND warehouse_id = vWarehouse GROUP BY item_id HAVING amount != 0; @@ -53431,7 +53661,181 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `stockTraslationkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `stockTraslationkk`(vDate DATE) +BEGIN + /** + * Calcula el stock del vWarehouse desde FechaInventario hasta v_date + sin tener en cuenta las salidas del mismo dia vDate + para ver el transporte a reservar + **/ + + DECLARE vWarehouse INT DEFAULT 7; + + DELETE FROM stockBuyed WHERE `date` = vDate; + DROP TEMPORARY TABLE IF EXISTS tmp.item; + + CREATE TEMPORARY TABLE tmp.item ( + `item_id` INT, + `amount` DECIMAL(10, 2) DEFAULT 0.00, + PRIMARY KEY(item_id) + ) ENGINE = MEMORY; + + + IF vDate >= CURDATE() THEN + INSERT INTO tmp.item + SELECT item_id, SUM(amount) amount + FROM vn2008.item_entry_in + WHERE dat = vDate + AND warehouse_id = vWarehouse + GROUP BY item_id HAVING amount != 0; + END IF; + + CALL `cache`.stock_refresh (FALSE); + + INSERT INTO tmp.item (item_id,amount) + SELECT item_id,s.amount FROM `cache`.stock s + WHERE warehouse_id = vWarehouse + ON DUPLICATE KEY UPDATE + amount = tmp.item.amount + VALUES(amount); + + CALL vn2008.item_last_buy_(vWarehouse,vDate); + + select * FROM tmp.item; + +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 DROP PROCEDURE IF EXISTS `stockTraslationTest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `stockTraslationTest`(vDate DATE) +BEGIN + /** + * Calcula el stock del vWarehouse desde FechaInventario hasta v_date + sin tener en cuenta las salidas del mismo dia vDate + para ver el transporte a reservar + **/ + + DECLARE vWarehouse INT DEFAULT 7; + + DELETE FROM stockBuyed WHERE `date` = vDate; + DROP TEMPORARY TABLE IF EXISTS tmp.item; + + CREATE TEMPORARY TABLE tmp.item ( + `item_id` INT, + `amount` DECIMAL(10, 2) DEFAULT 0.00, + PRIMARY KEY(item_id) + ) ENGINE = MEMORY; + + + IF vDate >= CURDATE() THEN + INSERT INTO tmp.item + SELECT item_id, SUM(amount) amount + FROM vn2008.item_entry_in + WHERE dat = vDate + AND warehouse_id = vWarehouse + GROUP BY item_id HAVING amount != 0; + END IF; + + CALL `cache`.stock_refresh (FALSE); + + INSERT INTO tmp.item (item_id,amount) + SELECT item_id,s.amount FROM `cache`.stock s + WHERE warehouse_id = vWarehouse + ON DUPLICATE KEY UPDATE + amount = tmp.item.amount + VALUES(amount); + + CALL vn2008.item_last_buy_(vWarehouse,vDate); +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 DROP PROCEDURE IF EXISTS `taxGetRates` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `taxGetRates`(vTaxDate DATE) + READS SQL DATA +BEGIN +/** + * Calcula una tabla con el IVA aplicable para la fecha data. + * + * @param vTaxDate + * @treturn tmp.taxGroup + * @treturn tmp.taxTax + */ + SET vTaxDate = IFNULL(vTaxDate, CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS + tmp.taxClass, + tmp.taxType; + + -- Calcula el tipo de IVA para cada clase en cada país. + + CREATE TEMPORARY TABLE tmp.taxClass + (INDEX (countryFk, taxClassFk)) + ENGINE = MEMORY + SELECT * + FROM ( + SELECT t.countryFk, g.taxClassFk, c.type + FROM vn.taxClassCode g + JOIN vn.taxCode c ON c.id = g.taxCodeFk + JOIN vn.taxType t ON t.id = c.taxTypeFk + WHERE g.effectived <= vTaxDate + ORDER BY g.effectived DESC + ) t + GROUP BY countryFk, taxClassFk; + + -- Calcula el impuesto para cada tipo de IVA en cada país. + + CREATE TEMPORARY TABLE tmp.taxType + (INDEX (countryFk, type)) + ENGINE = MEMORY + SELECT * + FROM ( + SELECT t.countryFk, c.type, + c.rate / 100 rate, + c.equalizationTax / 100 equalizationTax + FROM vn.taxCode c + JOIN vn.taxType t ON t.id = c.taxTypeFk + WHERE c.dated <= vTaxDate AND t.isAccrued + ORDER BY c.dated DESC, c.equalizationTax DESC + ) t + GROUP BY countryFk, type; +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 DROP PROCEDURE IF EXISTS `ticketClosure` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53449,13 +53853,13 @@ BEGIN * tickets de la table ticketClosure. */ - DECLARE vDone BOOL; - DECLARE vClientFk INT; + DECLARE vDone BOOL; + DECLARE vClientFk INT; DECLARE vCredit INT; DECLARE vPayMethod INT; DECLARE vTicketFk INT; DECLARE vIsToBeMailed BOOL; - DECLARE vIsTaxDataChecked BOOL; + DECLARE vIsTaxDataChecked BOOL; DECLARE vCompanyFk INT; DECLARE vDeliveryMethod INT; DECLARE vAgencyFk INT; @@ -53473,159 +53877,113 @@ BEGIN DECLARE vReportDeliveryNote INT DEFAULT 1; DECLARE vReportInvoice INT DEFAULT 3; DECLARE vNewPackageTicket INT; - DECLARE vNewInvoiceId INT; + DECLARE vNewInvoiceId INT; + DECLARE vHasToInvoice BOOL; - DECLARE cur CURSOR FOR - SELECT ticketFk FROM tmp.ticketClosure; + DECLARE cur CURSOR FOR + SELECT ticketFk FROM tmp.ticketClosure; - -- DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - -- DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - -- ROLLBACK; - -- RESIGNAL; - -- END; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + RESIGNAL; + END; - INSERT INTO dailyTaskLog(state) VALUES('ticketClosure START'); - - OPEN cur; + OPEN cur; proc: LOOP - SET vDone = FALSE; + SET vDone = FALSE; SET vNewPackageTicket = 0; FETCH cur INTO vTicketFk; IF vDone THEN - LEAVE proc; - END IF; + LEAVE proc; + END IF; - -- ticketClosure start - INSERT INTO dailyTaskLog(state) VALUES(CONCAT('ticketClosure: ', vTicketFk, ' START')); - SELECT 1; + -- ticketClosure start SELECT - c.id, - c.credit, - c.paymentMethodFk, - c.isToBeMailed, - c.isTaxDataChecked, - t.companyFk, - IFNULL(aw.agencyType, a.deliveryMethod) AS deliveryMethod, - a.id AS agencyFk, - t.agencyModeFk, - t.warehouseFk, - t.shipped - INTO vClientFk, - vCredit, - vPayMethod, - vIsToBeMailed, - vIsTaxDataChecked, - vCompanyFk, - vDeliveryMethod, - vAgencyFk, - vAgencyModeFk, - vWarehouseFk, - vShipped - FROM ticket t - INNER JOIN `client` c ON c.id = t.clientFk - LEFT JOIN agencyMode a ON a.id = t.agencyModeFk - LEFT JOIN agencyWarehouse aw ON a.id = aw.agencyFk AND t.warehouseFk = aw.warehouseFk - WHERE t.id = vTicketFk; - SELECT 2; + c.id, + c.credit, + c.paymentMethodFk, + c.isToBeMailed, + c.isTaxDataChecked, + t.companyFk, + IFNULL(aw.agencyType, a.deliveryMethod) AS deliveryMethod, + a.id AS agencyFk, + t.agencyModeFk, + t.warehouseFk, + t.shipped, + c.hasToInvoice + INTO vClientFk, + vCredit, + vPayMethod, + vIsToBeMailed, + vIsTaxDataChecked, + vCompanyFk, + vDeliveryMethod, + vAgencyFk, + vAgencyModeFk, + vWarehouseFk, + vShipped, + vHasToInvoice + FROM ticket t + INNER JOIN `client` c ON c.id = t.clientFk + LEFT JOIN agencyMode a ON a.id = t.agencyModeFk + LEFT JOIN agencyWarehouse aw ON a.id = aw.agencyFk AND t.warehouseFk = aw.warehouseFk + WHERE t.id = vTicketFk; + -- Fusión de ticket CALL mergeTicketUnattended(vTicketFk, TRUE); - IF vWarehouseFk = vWarehouseVnh OR vWareHouseFk = vWarehouseFloramondo THEN - SELECT 2.2; - -- Número de expediciones con cubos retornables - SELECT COUNT(*) INTO vhasPackage - FROM expedition e - JOIN package p ON p.itemFk = e.itemFk - WHERE e.ticketFk = vTicketFk - AND p.isPackageReturnable - LIMIT 1; - - IF vhasPackage THEN - - -- Si no existe un ticket de embalajes creamos uno, de lo contrario cogemos el actual - SELECT id INTO vNewPackageTicket - FROM ticket - WHERE companyFk = vCompanyCcs - AND agencyModeFk = vAgencyPackage - AND clientFk = vClientFk - AND shipped = CURDATE() - AND refFk IS NULL - LIMIT 1; - - IF ISNULL(vNewPackageTicket) OR vNewPackageTicket = 0 THEN - CALL ticketCreate(vClientFk, CURDATE(), vWarehouseFk, vCompanyCcs, '', vAgencyPackage, '', DATE_ADD(CURDATE(), INTERVAL 1 DAY), vNewPackageTicket); - END IF; - SELECT 2.3; - -- Retornables van al ticket de la empresa CCs - INSERT INTO movement (item, ticket, concept, amount, price, priceFixed) - (SELECT e.itemFk, vNewPackageTicket, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 - FROM expedition e - JOIN item i ON i.id = e.itemFk - LEFT JOIN package p ON p.itemFk = i.id - WHERE e.ticketFk = vTicketFk AND p.isPackageReturnable - GROUP BY e.itemFk); - - END IF; - - -- No retornables o no catalogados - INSERT INTO movement (item, ticket, concept, amount, price, priceFixed) - (SELECT e.itemFk, vTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 - FROM expedition e - JOIN item i ON i.id = e.itemFk - LEFT JOIN package p ON p.itemFk = i.id - WHERE e.ticketFk = vTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 - GROUP BY e.itemFk); - - -- Albaran_print - CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), 20); - INSERT INTO printServerQueue(priorityFk, reportFk, param1) VALUES(vPriority, vReportDeliveryNote, vTicketFk); - ELSE - -- Inserción de los continentes: cajas, cubos... - INSERT INTO movement (item, ticket, concept, amount, price, priceFixed) - (SELECT e.item, vTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 - FROM expedition e - JOIN item i ON i.id = e.itemFk - WHERE e.ticketFk = vTicketFk - GROUP BY e.itemFk); - END IF; - - IF(vCredit <= 1 OR vCompanyFk = vCompanyBlk OR vPayMethod = vPayMethodCard) THEN - SELECT 4; - -- Facturacion rapida - CALL ticketTrackingAdd(vTicketFk, 'DELIVERED', 20); + INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) + (SELECT vTicketFk, p.id, COUNT(*) + FROM expedition e + JOIN package p ON p.itemFk = e.itemFk + WHERE e.ticketFk = vTicketFk AND p.isPackageReturnable + GROUP BY p.itemFk); + + -- No retornables o no catalogados + INSERT INTO sale (itemFk, ticketFk, concept, quantity, price) + (SELECT e.itemFk, vTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk) + FROM expedition e + JOIN item i ON i.id = e.itemFk + LEFT JOIN package p ON p.itemFk = i.id + WHERE e.ticketFk = vTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 + GROUP BY e.itemFk); + + -- Albaran_print + CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), 20); + INSERT INTO printServerQueue(priorityFk, reportFk, param1) VALUES(vPriority, vReportDeliveryNote, vTicketFk); + + IF((vCredit <= 1 OR vPayMethod = vPayMethodCard) AND vHasToInvoice <> FALSE) THEN + + -- Facturacion rapida + CALL ticketTrackingAdd(vTicketFk, 'DELIVERED', 20); -- Facturar si está contabilizado IF vIsTaxDataChecked THEN - IF (SELECT clientTaxArea(vClientFk, vCompanyFk)) = 'NATIONAL' THEN - CALL invoiceMakeByClient( - vClientFk, + IF (SELECT clientTaxArea(vClientFk, vCompanyFk)) = 'NATIONAL' THEN + CALL invoiceMakeByClient( + vClientFk, (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), vShipped, vCompanyFk, vNewInvoiceId); ELSE - CALL invoiceMakeByTicket(vTicketFk, (SELECT invoiceSerial(vClientFk, vCompanyFk, 'R')), vNewInvoiceId); + CALL invoiceMakeByTicket(vTicketFk, (SELECT invoiceSerial(vClientFk, vCompanyFk, 'R')), vNewInvoiceId); END IF; - - END IF; - ELSE - SELECT 5; - -- Albaran_print - CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), 20); + ELSE + + -- Albaran_print + CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), 20); INSERT INTO printServerQueue(priorityFk, reportFk, param1) VALUES(vPriority, vReportDeliveryNote, vTicketFk); END IF; - -- ticketClosure end - INSERT INTO dailyTaskLog(state) VALUES(CONCAT('ticketClosure: ', vTicketFk, ' END')); - END LOOP; - - CLOSE cur; - - INSERT INTO dailyTaskLog(state) VALUES('ticketClosure END'); + -- ticketClosure end + END LOOP; + + CLOSE cur; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53708,6 +54066,155 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticketClosurekk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketClosurekk`() +BEGIN +/** + * Realiza el cierre de todos los + * tickets de la table ticketClosure. + */ + + DECLARE vDone BOOL; + DECLARE vClientFk INT; + DECLARE vCredit INT; + DECLARE vPayMethod INT; + DECLARE vTicketFk INT; + DECLARE vIsToBeMailed BOOL; + DECLARE vIsTaxDataChecked BOOL; + DECLARE vCompanyFk INT; + DECLARE vDeliveryMethod INT; + DECLARE vAgencyFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vPayMethodCard INT DEFAULT 5; + DECLARE vPriority INT DEFAULT 1; + DECLARE vReportDeliveryNote INT DEFAULT 1; + DECLARE vNewInvoiceId INT; + DECLARE vHasToInvoice BOOL; + + DECLARE cur CURSOR FOR + SELECT ticketFk FROM tmp.ticketClosure; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + RESIGNAL; + END; + + INSERT INTO dailyTaskLog(state) VALUES('ticketClosure: START'); + + OPEN cur; + + proc: LOOP + SET vDone = FALSE; + + FETCH cur INTO vTicketFk; + + IF vDone THEN + LEAVE proc; + END IF; + + -- ticketClosure start + SELECT + c.id, + c.credit, + c.paymentMethodFk, + c.isToBeMailed, + c.isTaxDataChecked, + t.companyFk, + IFNULL(aw.agencyType, a.deliveryMethod) AS deliveryMethod, + a.id AS agencyFk, + t.agencyModeFk, + t.warehouseFk, + t.shipped, + c.hasToInvoice + INTO vClientFk, + vCredit, + vPayMethod, + vIsToBeMailed, + vIsTaxDataChecked, + vCompanyFk, + vDeliveryMethod, + vAgencyFk, + vAgencyModeFk, + vWarehouseFk, + vShipped, + vHasToInvoice + FROM ticket t + INNER JOIN `client` c ON c.id = t.clientFk + LEFT JOIN agencyMode a ON a.id = t.agencyModeFk + LEFT JOIN agencyWarehouse aw ON a.id = aw.agencyFk AND t.warehouseFk = aw.warehouseFk + WHERE t.id = vTicketFk; + + -- Fusión de ticket + CALL mergeTicketUnattended(vTicketFk, TRUE); + + INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) + (SELECT vTicketFk, p.id, COUNT(*) + FROM expedition e + JOIN package p ON p.itemFk = e.itemFk + WHERE e.ticketFk = vTicketFk AND p.isPackageReturnable + GROUP BY p.itemFk); + + -- No retornables o no catalogados + INSERT INTO movement (item, ticket, concept, amount, price, priceFixed) + (SELECT e.itemFk, vTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 + FROM expedition e + JOIN item i ON i.id = e.itemFk + LEFT JOIN package p ON p.itemFk = i.id + WHERE e.ticketFk = vTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 + GROUP BY e.itemFk); + + -- Albaran_print + CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), 20); + INSERT INTO printServerQueue(priorityFk, reportFk, param1) VALUES(vPriority, vReportDeliveryNote, vTicketFk); + + IF((vCredit <= 1 OR vPayMethod = vPayMethodCard) AND vHasToInvoice <> FALSE) THEN + + -- Facturacion rapida + CALL ticketTrackingAdd(vTicketFk, 'DELIVERED', 20); + -- Facturar si está contabilizado + IF vIsTaxDataChecked THEN + + IF (SELECT clientTaxArea(vClientFk, vCompanyFk)) = 'NATIONAL' THEN + CALL invoiceMakeByClient( + vClientFk, + (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), + vShipped, + vCompanyFk, + vNewInvoiceId); + ELSE + CALL invoiceMakeByTicket(vTicketFk, (SELECT invoiceSerial(vClientFk, vCompanyFk, 'R')), vNewInvoiceId); + END IF; + + END IF; + ELSE + -- Albaran_print + CALL ticketTrackingAdd(vTicketFk, (SELECT vn.getAlert3State(vTicketFk)), 20); + INSERT INTO printServerQueue(priorityFk, reportFk, param1) VALUES(vPriority, vReportDeliveryNote, vTicketFk); + END IF; + + -- ticketClosure end + END LOOP; + + CLOSE cur; + + INSERT INTO dailyTaskLog(state) VALUES('ticketClosure: END'); +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 DROP PROCEDURE IF EXISTS `ticketClosureMultiWarehouse` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53895,66 +54402,278 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ticketCreate`( - IN vClientId INT - , IN vShipped DATE - , IN vWarehouseId INT - , IN vCompanyFk INT - , IN vAddressFk INT - , IN vAgencyType INT - , IN vRouteFk INT - , IN vlanded DATE - , OUT vNewTicket INT) + vClientId INT + ,vShipped DATE + ,vWarehouseId INT + ,vCompanyFk INT + ,vAddressFk INT + ,vAgencyType INT + ,vRouteFk INT + ,vlanded DATE + ,OUT vNewTicket INT) BEGIN DECLARE vClientOrnamentales INT DEFAULT 5270; - DECLARE vCompanyOrn INT DEFAULT 1381; - DECLARE vProvinceName VARCHAR(255); - + DECLARE vCompanyOrn INT DEFAULT 1381; + DECLARE vProvinceName VARCHAR(255); + SELECT p.name INTO vProvinceName FROM vn.client c - JOIN province p ON p.id = c.province - WHERE c.id = vClientId; - - IF vProvinceName IN ('SANTA CRUZ DE TENERIFE','LAS PALMAS DE GRAN CANARIA') AND vClientId <> vClientOrnamentales THEN + JOIN province p ON p.id = c.provinceFk + WHERE c.id = vClientId; + + IF vProvinceName IN ('SANTA CRUZ DE TENERIFE', 'LAS PALMAS DE GRAN CANARIA') + AND vClientId <> vClientOrnamentales + THEN SET vCompanyFk = vCompanyOrn; END IF; - INSERT INTO vn2008.Tickets ( - Id_Cliente, - Fecha, - Id_Consigna, - Id_Agencia, - Alias, - warehouse_id, - Id_Ruta, - empresa_id, - landing) - SELECT - vClientId, - vShipped, - a.id, - IF(vAgencyType,vAgencyType,a.agencyFk), - a.nickname, - vWarehouseId, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded - FROM address a + INSERT INTO vn2008.Tickets ( + Id_Cliente, + Fecha, + Id_Consigna, + Id_Agencia, + Alias, + warehouse_id, + Id_Ruta, + empresa_id, + landing + ) + SELECT + vClientId, + vShipped, + a.id, + IF(vAgencyType,vAgencyType,a.agencyFk), + a.nickname, + vWarehouseId, + IF(vRouteFk,vRouteFk,NULL), + vCompanyFk, + vlanded + FROM address a JOIN agencyMode am ON am.id = a.agencyFk - WHERE IF(vAddressFk, a.id = vAddressFk, a.defaultAddress != 0) - AND a.clientFk = vClientId + WHERE IF(vAddressFk, a.id = vAddressFk, a.isDefaultAddress != FALSE) + AND a.clientFk = vClientId LIMIT 1; - + SET vNewTicket = LAST_INSERT_ID(); - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vNewTicket,ao.observationTypeFk, ao.description - FROM addressObservation ao - JOIN address a ON a.id =ao.addressFk - WHERE a.clientFk = vClientId - AND IF(vAddressFk, a.id = vAddressFk, a.defaultAddress != 0); + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vNewTicket,ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN address a ON a.id = ao.addressFk + WHERE a.clientFk = vClientId AND a.isDefaultAddress != FALSE; - CALL logAdd(vNewTicket,'insert','ticket',concat('CREA EL TICKET',' ',vNewTicket)); + CALL logAdd(vNewTicket, 'insert', 'ticket', CONCAT('CREA EL TICKET', ' ', vNewTicket)); + IF (SELECT isCreatedAsServed FROM vn.client WHERE id = vClientId ) <> FALSE + THEN + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vNewTicket, getWorker() + FROM state + WHERE `code` = 'DELIVERED'; + 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 DROP PROCEDURE IF EXISTS `ticketGetTax` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`() + READS SQL DATA +BEGIN +/** + * Calcula la base imponible, el IVA y el recargo de equivalencia para + * un conjunto de tickets. + * + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @treturn tmp.ticketTax Impuesto desglosado para cada ticket + * @return tmp.ticketAmount + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketArea; + CREATE TEMPORARY TABLE tmp.ticketArea + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tmpTicket.ticketFk, addressTaxArea(t.addressFk, t.companyFk) areaFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2) + ) AS taxableBase, + SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2) + ) * pgc.rate / 100 AS tax, + tc.code + + FROM tmp.ticket tmpTicket + JOIN tmp.ticketArea ta ON ta.ticketFk = tmpTicket.ticketFk + JOIN sale s ON s.ticketFk = tmpTicket.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = tmpTicket.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ta.areaFk + AND bp.taxClassFk = itc.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tmpTicket.ticketFk, pgc.code + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, taxableBase, SUM(tax) tax + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketArea; + +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 DROP PROCEDURE IF EXISTS `ticketGetTaxkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTaxkk`(vBillingDate DATE) + READS SQL DATA +BEGIN +/** + * Calcula la base imponible, el IVA y el recargo de equivalencia para + * un conjunto de tickets. + * + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @param vBillingDate Fecha de facturación + * @treturn tmp.ticketTax Impuesto desglosado para cada ticket + */ + CALL vn.taxGetRates (vBillingDate); + + -- Calcula el IVA y el recargo desglosado para cada ticket. + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT t.ticketFk, t.type, t.taxBase, + CAST(IF(t.hasTax, t.taxBase * x.rate, 0) AS DECIMAL(10,2)) tax, + CAST(IF(t.hasEqualizationTax, t.taxBase * x.equalizationTax, 0) AS DECIMAL(10,2)) equalizationTax + FROM ( + SELECT i.ticketFk, g.countryFk, g.type + ,SUM(CAST(m.quantity * m.price * (100 - m.discount) / 100 AS DECIMAL(10,2))) AS taxBase + ,NOT(c.isVies AND p.countryFk <> c.countryFk) hasTax + ,c.isEqualizated != FALSE AS hasEqualizationTax + FROM tmp.ticket i + JOIN vn.ticket t ON t.id = i.ticketFk + JOIN vn.sale m ON m.ticketFk = t.id + JOIN vn.item a ON a.id = m.itemFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.supplier p ON p.id = t.companyFk + JOIN tmp.taxClass g + ON g.countryFk = p.countryFk AND g.taxClassFk = a.taxClassFk + GROUP BY i.ticketFk, g.type + ) t + JOIN tmp.taxType x + ON x.countryFk = t.countryFk AND x.type = t.type; + + DROP TEMPORARY TABLE + tmp.taxClass, + tmp.taxType; +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 DROP PROCEDURE IF EXISTS `ticketGetTotal` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTotal`() + READS SQL DATA +BEGIN +/** + * Calcula el total con IVA para un conjunto de tickets. + * + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @return tmp.ticketTotal Total para cada ticket + */ + CALL ticketGetTax (); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTotal; + CREATE TEMPORARY TABLE tmp.ticketTotal + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, SUM(ta.taxableBase + ta.tax) AS total + FROM tmp.ticketAmount ta GROUP BY ticketFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticketGetTotalkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTotalkk`() + READS SQL DATA +BEGIN +/** + * Calcula el total con IVA para un conjunto de tickets. + * + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @treturn tmp.ticketTotal Total para cada ticket + */ + CALL ticketGetTax (NULL); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTotal; + CREATE TEMPORARY TABLE tmp.ticketTotal + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, SUM(taxBase + tax + equalizationTax) AS total + FROM tmp.ticketTax GROUP BY ticketFk; + + DROP TEMPORARY TABLE tmp.ticketTax; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54129,7 +54848,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ticketToInvoiceByTicket` */; +/*!50003 DROP PROCEDURE IF EXISTS `ticketToInvoiceByTicketkk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -54139,7 +54858,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticketToInvoiceByTicket`(vTicket INT) +CREATE DEFINER=`root`@`%` PROCEDURE `ticketToInvoiceByTicketkk`(vTicket INT) BEGIN DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; @@ -54182,8 +54901,55 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerCreateExternal` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `workerCreateExternal`( + vFirstName VARCHAR(50), + vSurname1 VARCHAR(50), + vSurname2 VARCHAR(50), + vUser VARCHAR(20), + vPassword VARCHAR(50), + vWorkerCode VARCHAR(3), + vRole INT(2) + ) +BEGIN + + DECLARE vUserId INT; + DECLARE vWorkerPako INT DEFAULT 2; + DECLARE vSurnames VARCHAR(100); + + INSERT INTO account.user(name,password,role) + SELECT vUser,MD5(vPassword),vRole; + + SET vUserId = LAST_INSERT_ID(); + /* + INSERT INTO vn.worker(firstName,name,bossFk,workerCode,user_id) + SELECT vFirstName,CONCAT(vSurname1,' ',vSurname2),2,vWorkerCode,vUser; + */ + + IF vSurname2 IS NULL THEN + SET vSurnames = vSurname1; + ELSE + SET vSurnames = CONCAT(vSurname1, ' ', vSurname2); + END IF; + + INSERT INTO vn2008.Trabajadores(Nombre, Apellidos, boss, CodigoTrabajador, user_id) + SELECT vFirstName, vSurnames, vWorkerPako, vWorkerCode, vUserId; +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 DROP PROCEDURE IF EXISTS `workerDisable` */; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -54197,7 +54963,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisable`(vUserId int) BEGIN DELETE FROM account.account - WHERE user_id = vUserId; + WHERE id = vUserId; UPDATE account.user SET role = 2 @@ -54213,7 +54979,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `workingHours` */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -54291,647 +55056,7 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; - --- --- Current Database: `salix` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `salix` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; - -USE `salix`; - --- --- Table structure for table `ACL` --- - -DROP TABLE IF EXISTS `ACL`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ACL` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `model` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `property` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `accessType` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `permission` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `principalType` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `principalId` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `AccessToken` --- - -DROP TABLE IF EXISTS `AccessToken`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `AccessToken` ( - `id` varchar(255) CHARACTER SET utf8 NOT NULL, - `ttl` int(11) DEFAULT NULL, - `scopes` varchar(255) CHARACTER SET utf8 DEFAULT NULL, - `created` datetime DEFAULT NULL, - `userId` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `Account` --- - -DROP TABLE IF EXISTS `Account`; -/*!50001 DROP VIEW IF EXISTS `Account`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Account` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `password`, - 1 AS `roleFk`, - 1 AS `active`, - 1 AS `email`, - 1 AS `created`, - 1 AS `updated`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Accounting` --- - -DROP TABLE IF EXISTS `Accounting`; -/*!50001 DROP VIEW IF EXISTS `Accounting`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Accounting` AS SELECT - 1 AS `id`, - 1 AS `bank`, - 1 AS `account`, - 1 AS `accountingTypeFk`, - 1 AS `entityFk`, - 1 AS `isActive`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Address` --- - -DROP TABLE IF EXISTS `Address`; -/*!50001 DROP VIEW IF EXISTS `Address`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Address` AS SELECT - 1 AS `id`, - 1 AS `consignee`, - 1 AS `street`, - 1 AS `city`, - 1 AS `postcode`, - 1 AS `provinceFk`, - 1 AS `phone`, - 1 AS `mobile`, - 1 AS `isEnabled`, - 1 AS `isDefaultAddress`, - 1 AS `clientFk`, - 1 AS `defaultAgencyFk`, - 1 AS `longitude`, - 1 AS `latitude`, - 1 AS `isEqualizated`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Agency` --- - -DROP TABLE IF EXISTS `Agency`; -/*!50001 DROP VIEW IF EXISTS `Agency`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Agency` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `warehouseFk`, - 1 AS `isVolumetric`, - 1 AS `bankFk`, - 1 AS `warehouseAliasFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `AgencyMode` --- - -DROP TABLE IF EXISTS `AgencyMode`; -/*!50001 DROP VIEW IF EXISTS `AgencyMode`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `AgencyMode` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `description`, - 1 AS `agencyTypeFk`, - 1 AS `m3`, - 1 AS `agencyFk`, - 1 AS `inflation`, - 1 AS `sendMailTo`, - 1 AS `isForTicket`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Bank` --- - -DROP TABLE IF EXISTS `Bank`; -/*!50001 DROP VIEW IF EXISTS `Bank`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Bank` AS SELECT - 1 AS `id`, - 1 AS `bank`, - 1 AS `account`, - 1 AS `cash`, - 1 AS `entityFk`, - 1 AS `isActive`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `City` --- - -DROP TABLE IF EXISTS `City`; -/*!50001 DROP VIEW IF EXISTS `City`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `City` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `provinceFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Client` --- - -DROP TABLE IF EXISTS `Client`; -/*!50001 DROP VIEW IF EXISTS `Client`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Client` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `fi`, - 1 AS `socialName`, - 1 AS `contact`, - 1 AS `street`, - 1 AS `city`, - 1 AS `postcode`, - 1 AS `provinceFk`, - 1 AS `countryFk`, - 1 AS `email`, - 1 AS `phone`, - 1 AS `mobile`, - 1 AS `fax`, - 1 AS `active`, - 1 AS `discount`, - 1 AS `credit`, - 1 AS `creditInsurance`, - 1 AS `iban`, - 1 AS `dueDay`, - 1 AS `equalizationTax`, - 1 AS `hasToInvoice`, - 1 AS `invoiceByEmail`, - 1 AS `payMethodFk`, - 1 AS `salesPersonFk`, - 1 AS `contactChannelFk`, - 1 AS `sepaVnl`, - 1 AS `coreVnl`, - 1 AS `coreVnh`, - 1 AS `eypbc`, - 1 AS `quality`, - 1 AS `vies`, - 1 AS `isRelevant`, - 1 AS `typeFk`, - 1 AS `accountingAccount`, - 1 AS `created`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `ClientCredit` --- - -DROP TABLE IF EXISTS `ClientCredit`; -/*!50001 DROP VIEW IF EXISTS `ClientCredit`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ClientCredit` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `employeeFk`, - 1 AS `amount`, - 1 AS `created`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `ClientCreditLimit` --- - -DROP TABLE IF EXISTS `ClientCreditLimit`; -/*!50001 DROP VIEW IF EXISTS `ClientCreditLimit`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ClientCreditLimit` AS SELECT - 1 AS `id`, - 1 AS `maxAmount`, - 1 AS `roleFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `ClientObservation` --- - -DROP TABLE IF EXISTS `ClientObservation`; -/*!50001 DROP VIEW IF EXISTS `ClientObservation`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ClientObservation` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `employeeFk`, - 1 AS `text`, - 1 AS `created`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `ClientType` --- - -DROP TABLE IF EXISTS `ClientType`; -/*!50001 DROP VIEW IF EXISTS `ClientType`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ClientType` AS SELECT - 1 AS `id`, - 1 AS `code`, - 1 AS `type`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `ContactChannel` --- - -DROP TABLE IF EXISTS `ContactChannel`; -/*!50001 DROP VIEW IF EXISTS `ContactChannel`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ContactChannel` AS SELECT - 1 AS `id`, - 1 AS `name`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Country` --- - -DROP TABLE IF EXISTS `Country`; -/*!50001 DROP VIEW IF EXISTS `Country`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Country` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `inCee`, - 1 AS `code`, - 1 AS `currencyFk`, - 1 AS `realCountryFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `CreditClassification` --- - -DROP TABLE IF EXISTS `CreditClassification`; -/*!50001 DROP VIEW IF EXISTS `CreditClassification`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `CreditClassification` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `started`, - 1 AS `ended`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Employee` --- - -DROP TABLE IF EXISTS `Employee`; -/*!50001 DROP VIEW IF EXISTS `Employee`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Employee` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `surname`, - 1 AS `userFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `FakeProduction` --- - -DROP TABLE IF EXISTS `FakeProduction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `FakeProduction` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ticketFk` int(11) NOT NULL DEFAULT '0', - `clientFk` int(11) NOT NULL DEFAULT '0', - `client` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `date` date DEFAULT NULL, - `hour` time DEFAULT NULL, - `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `province` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `provinceFk` smallint(6) unsigned NOT NULL DEFAULT '0', - `agency` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `agencyFk` smallint(6) NOT NULL, - `lines` int(1) NOT NULL DEFAULT '0', - `m3` decimal(5,2) NOT NULL DEFAULT '0.00', - `problems` int(1) NOT NULL DEFAULT '0', - `problem` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `stateFk` bigint(4) NOT NULL DEFAULT '0', - `workerfk` int(11) NOT NULL DEFAULT '0', - `worker` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `salesPersonFk` int(11) NOT NULL DEFAULT '0', - `salesPerson` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `state` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `boxes` double DEFAULT NULL, - `routeFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Message` --- - -DROP TABLE IF EXISTS `Message`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Message` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uuid` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `sender` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `recipient` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `message` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `sendDate` datetime DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `MessageInbox` --- - -DROP TABLE IF EXISTS `MessageInbox`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `MessageInbox` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `uuid` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `sender` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `recipient` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `finalRecipient` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `message` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `sendDate` datetime DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `PayMethod` --- - -DROP TABLE IF EXISTS `PayMethod`; -/*!50001 DROP VIEW IF EXISTS `PayMethod`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `PayMethod` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `graceDays`, - 1 AS `outstandingDebt`, - 1 AS `ibanRequired`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Province` --- - -DROP TABLE IF EXISTS `Province`; -/*!50001 DROP VIEW IF EXISTS `Province`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Province` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `countryFk`, - 1 AS `warehouseFk`, - 1 AS `zoneFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Role` --- - -DROP TABLE IF EXISTS `Role`; -/*!50001 DROP VIEW IF EXISTS `Role`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Role` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `description`, - 1 AS `created`, - 1 AS `modified`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `RoleMapping` --- - -DROP TABLE IF EXISTS `RoleMapping`; -/*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `RoleMapping` AS SELECT - 1 AS `id`, - 1 AS `principalType`, - 1 AS `principalId`, - 1 AS `roleId`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Route` --- - -DROP TABLE IF EXISTS `Route`; -/*!50001 DROP VIEW IF EXISTS `Route`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Route` AS SELECT - 1 AS `id`, - 1 AS `date`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `State` --- - -DROP TABLE IF EXISTS `State`; -/*!50001 DROP VIEW IF EXISTS `State`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `State` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `order`, - 1 AS `alertLevel`, - 1 AS `code`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Ticket` --- - -DROP TABLE IF EXISTS `Ticket`; -/*!50001 DROP VIEW IF EXISTS `Ticket`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Ticket` AS SELECT - 1 AS `id`, - 1 AS `agencyFk`, - 1 AS `employeeFk`, - 1 AS `date`, - 1 AS `hour`, - 1 AS `clientFk`, - 1 AS `addressFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `TicketState` --- - -DROP TABLE IF EXISTS `TicketState`; -/*!50001 DROP VIEW IF EXISTS `TicketState`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `TicketState` AS SELECT - 1 AS `id`, - 1 AS `ticketFk`, - 1 AS `stateFk`, - 1 AS `employeeFk`, - 1 AS `updated`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Vehicle` --- - -DROP TABLE IF EXISTS `Vehicle`; -/*!50001 DROP VIEW IF EXISTS `Vehicle`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Vehicle` AS SELECT - 1 AS `id`, - 1 AS `numberPlate`, - 1 AS `tradeMark`, - 1 AS `model`, - 1 AS `companyFk`, - 1 AS `warehouseFk`, - 1 AS `description`, - 1 AS `m3`, - 1 AS `isActive`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view 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 `tpv`, - 1 AS `inventory`, - 1 AS `isManaged`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `WarehouseAlias` --- - -DROP TABLE IF EXISTS `WarehouseAlias`; -/*!50001 DROP VIEW IF EXISTS `WarehouseAlias`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `WarehouseAlias` AS SELECT - 1 AS `id`, - 1 AS `name`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Worker` --- - -DROP TABLE IF EXISTS `Worker`; -/*!50001 DROP VIEW IF EXISTS `Worker`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Worker` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `surname`, - 1 AS `userFk`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `Zone` --- - -DROP TABLE IF EXISTS `Zone`; -/*!50001 DROP VIEW IF EXISTS `Zone`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Zone` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `printingOrder`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `user` --- - -DROP TABLE IF EXISTS `user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `user` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `realm` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `username` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - `password` varchar(512) CHARACTER SET utf8 NOT NULL, - `email` varchar(512) CHARACTER SET utf8 NOT NULL, - `emailVerified` tinyint(1) DEFAULT NULL, - `verificationToken` varchar(512) CHARACTER SET utf8 DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping routines for database 'salix' --- -/*!50003 DROP PROCEDURE IF EXISTS `production_control_source` */; +/*!50003 DROP PROCEDURE IF EXISTS `zoneNest` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -54941,60 +55066,1048 @@ CREATE TABLE `user` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `production_control_source`(IN idWarehouse INT, IN scopeDays TINYINT) +CREATE DEFINER=`root`@`%` PROCEDURE `zoneNest`() BEGIN - - call vn2008.production_control_source(idWarehouse, scopeDays); - - /* - DROP TEMPORARY TABLE IF EXISTS FakeProduction_tmp; - - set @id=0; - - CREATE TEMPORARY TABLE FakeProduction_tmp - ENGINE=MEMORY AS - (select @id:=@id+1 as id, - tmp.Id_Ticket as ticketFk, - tmp.Id_Cliente as clientFk, - tmp.Alias as client, - tmp.Fecha as `date`, - tmp.Hora as hour, - tmp.POBLACION as city, - tmp.PROVINCIA as province, - tmp.province_id as provinceFk, - tmp.Agencia as agency, - tmp.agency_id as agencyFk, - tmp.lines, - tmp.m3, - tmp.problems, - tmp.problem, - tmp.state as stateFk, - t.Id_Trabajador as workerfk, - concat(t.Nombre, ' ', t.Apellidos) as worker, - tt.Id_Trabajador as salesPersonFk, - concat(tt.Nombre, ' ', tt.Apellidos) as salesPerson, - s.name as state, - tmp.Cajas as boxes, - tmp.Id_Ruta as routeFk - from tmp.production_buffer tmp - inner join vn2008.state s - on tmp.state = s.id - inner join vn2008.Trabajadores t - on tmp.CodigoTrabajador = t.CodigoTrabajador collate utf8_unicode_ci - inner join vn2008.Trabajadores tt - on tmp.Comercial = tt.CodigoTrabajador collate utf8_unicode_ci - ); - - DELETE FROM FakeProduction; - - INSERT INTO FakeProduction - SELECT * - FROM FakeProduction_tmp - WHERE routeFk IS NOT NULL - GROUP BY RouteFk - ORDER BY routeFk; - */ + DECLARE vDone BOOL; + DECLARE vParent INT DEFAULT 1; + DECLARE vGeoFk INT; + DECLARE vChildFk INT; + DECLARE vChildName VARCHAR(45); + + DECLARE townCur CURSOR FOR + SELECT p.geoFk, t.id, t.`name` + FROM town t + JOIN province p ON p.id = t.provinceFk + WHERE t.id BETWEEN 30001 AND 40000; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + -- > Town cursor start + OPEN townCur; + + townLoop: LOOP + SET vDone = FALSE; + + FETCH townCur INTO vParent, vChildFk, vChildName; + + IF vDone THEN + LEAVE townLoop; + END IF; + + CALL nestAdd('vn', 'zoneNest', vParent, vChildName); + + -- Update town geoFk + SET vGeoFk = LAST_INSERT_ID(); + UPDATE town SET geoFk = vGeoFk WHERE id = vChildFk; + END LOOP; + CLOSE townCur; + -- < Town cursor end +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Current Database: `edi` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `edi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `edi`; + +-- +-- Table structure for table `PriceDetails` +-- + +DROP TABLE IF EXISTS `PriceDetails`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `PriceDetails` ( + `ID` int(11) NOT NULL, + `SuplyResponseID` int(11) NOT NULL, + `PriceType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Price` decimal(10,2) DEFAULT NULL, + `BasisQuantitiy` int(11) DEFAULT NULL, + `BasisQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MinimumQuantity` int(11) DEFAULT NULL, + `MinimumQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MaximumQuantity Integer` int(11) DEFAULT NULL, + `MaximumQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `LatestDeliveryDateTime` datetime DEFAULT NULL, + `EarliestDespatchDateTime` datetime DEFAULT NULL, + `FirstOrderDateTime` datetime DEFAULT NULL, + `LatestOrderDateTime` datetime DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `batch` +-- + +DROP TABLE IF EXISTS `batch`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `batch` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `message_id` int(10) unsigned NOT NULL, + `type_id` smallint(5) unsigned NOT NULL, + `buy_edi_id` int(10) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `type_id` (`type_id`,`buy_edi_id`), + KEY `message_id` (`message_id`), + KEY `buy_edi_id` (`buy_edi_id`), + CONSTRAINT `batch_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `batch_ibfk_2` FOREIGN KEY (`buy_edi_id`) REFERENCES `vn2008`.`buy_edi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=276675 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `batch_type` +-- + +DROP TABLE IF EXISTS `batch_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `batch_type` ( + `id` mediumint(8) unsigned NOT NULL, + `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bucket` +-- + +DROP TABLE IF EXISTS `bucket`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bucket` ( + `bucket_id` int(11) unsigned NOT NULL, + `bucket_type_id` mediumint(8) unsigned NOT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `x_size` mediumint(8) unsigned NOT NULL, + `y_size` mediumint(8) unsigned NOT NULL, + `z_size` mediumint(8) unsigned NOT NULL, + `entry_date` date DEFAULT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime DEFAULT NULL, + PRIMARY KEY (`bucket_id`), + KEY `group_id` (`y_size`), + KEY `plant_id` (`x_size`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/CK090916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bucket_type` +-- + +DROP TABLE IF EXISTS `bucket_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bucket_type` ( + `bucket_type_id` mediumint(8) unsigned NOT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date DEFAULT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime DEFAULT NULL, + PRIMARY KEY (`bucket_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/FB090916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `config` +-- + +DROP TABLE IF EXISTS `config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `config` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `log_mail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Mail where the log information is sent', + `presale_id` mediumint(8) unsigned DEFAULT NULL, + `default_kop` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `presale_id` (`presale_id`), + CONSTRAINT `config_ibfk_1` FOREIGN KEY (`presale_id`) REFERENCES `batch_type` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `deliveryInformation` +-- + +DROP TABLE IF EXISTS `deliveryInformation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryInformation` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `DeliveryType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `DeliveryPrice` decimal(10,2) DEFAULT NULL, + `ChargeAmount` decimal(10,2) DEFAULT NULL, + `BasisQuantitiy` int(11) DEFAULT NULL, + `MinimumQuantity` int(11) DEFAULT NULL, + `MaximumQuantity Integer` int(11) DEFAULT NULL, + `LatestDeliveryDateTime` datetime DEFAULT NULL, + `EarliestDespatchDateTime` datetime DEFAULT NULL, + `FirstOrderDateTime` datetime DEFAULT NULL, + `LatestOrderDateTime` datetime DEFAULT NULL, + `supplyResponseID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `feature` +-- + +DROP TABLE IF EXISTS `feature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `feature` ( + `item_id` int(11) unsigned NOT NULL, + `feature_type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `feature_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date NOT NULL, + `expiry_date` date NOT NULL, + `change_date_time` datetime NOT NULL, + PRIMARY KEY (`item_id`,`feature_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FF130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `file_config` +-- + +DROP TABLE IF EXISTS `file_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `file_config` ( + `file_name` varchar(2) COLLATE utf8_unicode_ci NOT NULL, + `to_table` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `file` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `updated` date DEFAULT NULL, + PRIMARY KEY (`file_name`), + UNIQUE KEY `to_table` (`to_table`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ftp_config` +-- + +DROP TABLE IF EXISTS `ftp_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ftp_config` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `host` varchar(255) CHARACTER SET utf8 NOT NULL, + `user` varchar(50) CHARACTER SET utf8 NOT NULL, + `password` varchar(50) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `genus` +-- + +DROP TABLE IF EXISTS `genus`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `genus` ( + `genus_id` mediumint(8) unsigned NOT NULL, + `latin_genus_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date DEFAULT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime DEFAULT NULL, + PRIMARY KEY (`genus_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `goodCharacteristic` +-- + +DROP TABLE IF EXISTS `goodCharacteristic`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `goodCharacteristic` ( + `supplyResponse` varchar(26) COLLATE utf8_unicode_ci NOT NULL, + `type` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.type', + `value` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.value', + PRIMARY KEY (`supplyResponse`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `imap_config` +-- + +DROP TABLE IF EXISTS `imap_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `imap_config` ( + `id` tinyint(3) unsigned NOT NULL, + `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost', + `user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `pass` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `clean_period` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'How long the old mails are preserved', + `success_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, + `error_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `item` +-- + +DROP TABLE IF EXISTS `item`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item` ( + `id` int(11) unsigned NOT NULL, + `product_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `plant_id` mediumint(8) unsigned DEFAULT NULL, + `group_id` int(11) DEFAULT NULL, + `entry_date` date DEFAULT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `group_id` (`group_id`), + KEY `plant_id` (`plant_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `item_feature` +-- + +DROP TABLE IF EXISTS `item_feature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_feature` ( + `item_id` int(11) NOT NULL, + `presentation_order` tinyint(11) unsigned NOT NULL, + `feature` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `regulation_type` tinyint(3) unsigned NOT NULL, + `entry_date` date NOT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime NOT NULL, + PRIMARY KEY (`item_id`,`presentation_order`,`entry_date`,`change_date_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FY130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `item_feature_bi` BEFORE INSERT ON `item_feature` FOR EACH ROW +BEGIN + IF NEW.expiry_date = '0000-00-00' THEN + SET NEW.expiry_date = NULL; + 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 */ ; + +-- +-- Table structure for table `item_group` +-- + +DROP TABLE IF EXISTS `item_group`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_group` ( + `group_code` int(11) unsigned NOT NULL, + `dutch_group_description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date NOT NULL, + `expiry_date` date NOT NULL, + `change_date_time` datetime NOT NULL, + PRIMARY KEY (`group_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FO130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `item_track` +-- + +DROP TABLE IF EXISTS `item_track`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_track` ( + `item_id` int(10) unsigned NOT NULL, + `s1` tinyint(3) NOT NULL DEFAULT '0', + `s2` tinyint(3) NOT NULL DEFAULT '0', + `s3` tinyint(3) NOT NULL DEFAULT '0', + `s4` tinyint(3) NOT NULL DEFAULT '0', + `pac` tinyint(3) NOT NULL DEFAULT '0', + `cat` tinyint(3) NOT NULL DEFAULT '0', + `ori` tinyint(3) NOT NULL DEFAULT '0', + `pro` tinyint(3) NOT NULL DEFAULT '0', + `package` tinyint(3) NOT NULL DEFAULT '0', + `s5` tinyint(3) NOT NULL DEFAULT '0', + `s6` tinyint(3) NOT NULL DEFAULT '0', + `kop` tinyint(3) NOT NULL DEFAULT '0', + `sub` tinyint(3) NOT NULL DEFAULT '0', + PRIMARY KEY (`item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mail` +-- + +DROP TABLE IF EXISTS `mail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mail` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mail` varchar(150) COLLATE utf8_unicode_ci NOT NULL, + `kop` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `mail` (`mail`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `message` +-- + +DROP TABLE IF EXISTS `message`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `message` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `sender_id` int(10) unsigned DEFAULT NULL, + `mail_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `mail_id` (`mail_id`), + KEY `sender_id` (`sender_id`), + CONSTRAINT `message_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=296385 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `param` +-- + +DROP TABLE IF EXISTS `param`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `param` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(5) COLLATE utf8_unicode_ci NOT NULL, + `subname` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `position` tinyint(3) unsigned NOT NULL DEFAULT '1', + `type` enum('INTEGER','DOUBLE','STRING','DATE','TIME') COLLATE utf8_unicode_ci NOT NULL, + `required` tinyint(3) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`,`subname`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `plant` +-- + +DROP TABLE IF EXISTS `plant`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `plant` ( + `plant_id` mediumint(8) unsigned NOT NULL, + `genus_id` mediumint(8) unsigned NOT NULL, + `specie_id` mediumint(8) unsigned DEFAULT NULL, + `entry_date` date DEFAULT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime DEFAULT NULL, + PRIMARY KEY (`plant_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FT130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `putOrder` +-- + +DROP TABLE IF EXISTS `putOrder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `putOrder` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `deliveryInformationID` int(11) DEFAULT NULL, + `supplyResponsID` int(11) DEFAULT NULL, + `orderTradelineItemID` int(11) DEFAULT NULL COMMENT 'ticketFk', + `OrderTradeLineDateTime` datetime DEFAULT NULL, + `quantity` int(11) DEFAULT NULL, + `EndUserPartyID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `EndUserPartyGLN` tinyint(4) DEFAULT NULL, + `OrderStatus` int(11) DEFAULT NULL COMMENT '1 pending\n2 confirmed\n3 canceled', + `isOrderProcessed` tinyint(4) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `orderTradelineItemID_UNIQUE` (`orderTradelineItemID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `specie` +-- + +DROP TABLE IF EXISTS `specie`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `specie` ( + `specie_id` mediumint(8) unsigned NOT NULL, + `genus_id` mediumint(8) unsigned NOT NULL, + `latin_species_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date DEFAULT NULL, + `expiry_date` date DEFAULT NULL, + `change_date_time` datetime DEFAULT NULL, + PRIMARY KEY (`specie_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FS130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplier` +-- + +DROP TABLE IF EXISTS `supplier`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplier` ( + `supplier_id` int(10) unsigned NOT NULL COMMENT 'FHRegistrationNr', + `glnAddressCode` varchar(13) CHARACTER SET utf8 DEFAULT NULL, + `company_name` varchar(70) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date NOT NULL, + `expiry_date` date NOT NULL, + `change_date_time` datetime NOT NULL, + PRIMARY KEY (`supplier_id`), + KEY `glnaddressCodeidx` (`glnAddressCode`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/FEC010104/CC090916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplyResponse` +-- + +DROP TABLE IF EXISTS `supplyResponse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplyResponse` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `NumberBunchesPerCask` int(11) DEFAULT NULL, + `SupplierGLN` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `NewItem` tinyint(1) DEFAULT NULL, + `SendererID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ItemSupplierID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `TransactionDate` datetime DEFAULT NULL, + `TransactionNumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `AuctionClockNumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `SupplierID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ItemDatesupplyResponsecol` datetime DEFAULT NULL, + `Item_ArticleCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `VBNOmschrijving` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ExtraRemark` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ArtCodeType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `VBNGroupCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `VBNGroupDescription` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `TransactionTime` time DEFAULT NULL, + `CountryOfOrigin` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `NumberOfItemsPerCask` int(11) DEFAULT NULL, + `NumberOfLayersPerTrolley` int(11) DEFAULT NULL, + `NumberOfUnits` int(11) DEFAULT NULL, + `MinimumNumberToOrder` int(11) DEFAULT NULL, + `MinimumOrderUnitType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Price` decimal(10,2) DEFAULT NULL, + `PotSize` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Height` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Length` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Weight` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Quality` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `NumberOfBuds` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `NumberOfBudsPerStem` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ExaminiationCode1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ExaminiationCode2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Diameter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `PlantDiameter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `Potshape` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `FlowerShape` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `FlowerColor` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `PotColor` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `PotMaterial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MaterialHeight` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MaterialDiameter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `OtherMaterial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `OrderUnitType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `EmbalageCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `PictureReference` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `AgentGLN` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `MaximumNumberToOrder` int(11) DEFAULT NULL, + `MaximumOrderType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley', + `IncrementalOrderableQuantity` int(11) DEFAULT NULL, + `IncrementalOrderableQuantityType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley', + `PackingPrice` decimal(10,2) DEFAULT NULL, + `PackingPriceType` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `PackingPriceQuantity` int(11) DEFAULT NULL, + `PackingQuantityType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley', + `MarketPlaceID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `ID_UNIQUE` (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `type` +-- + +DROP TABLE IF EXISTS `type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `type` ( + `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `type_group_id` tinyint(3) unsigned NOT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date NOT NULL, + `expiry_date` date NOT NULL, + `change_date_time` datetime NOT NULL, + PRIMARY KEY (`type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FE130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `value` +-- + +DROP TABLE IF EXISTS `value`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `value` ( + `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `type_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `type_description` varchar(70) COLLATE utf8_unicode_ci NOT NULL, + `entry_date` date NOT NULL, + `expiry_date` date NOT NULL, + `change_date_time` datetime NOT NULL, + PRIMARY KEY (`type_id`,`type_value`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FV130916.txt'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'edi' +-- + +-- +-- Dumping routines for database 'edi' +-- +/*!50003 DROP PROCEDURE IF EXISTS `batchNew` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `batchNew`( + vMessage INT + ,vItem VARCHAR(255) + ,vType MEDIUMINT + ,vDeliveryNumber BIGINT + ,vDate DATE + ,vHour TIME + ,vRef INT + ,vAgj INT + ,vCat VARCHAR(2) + ,vPac INT + ,vSub MEDIUMINT + ,vKop INT + ,vPtd VARCHAR(6) + ,vPro MEDIUMINT + ,vOrigin VARCHAR(3) + ,vPtj MEDIUMINT + ,vQuantiy INT + ,vPrice DOUBLE + ,vClock SMALLINT + ,vS1 VARCHAR(3) + ,vS2 VARCHAR(3) + ,vS3 VARCHAR(3) + ,vS4 VARCHAR(4) + ,vS5 VARCHAR(3) + ,vS6 VARCHAR(3) + ,vK1 SMALLINT + ,vK2 SMALLINT + ,vP1 TINYINT + ,vP2 TINYINT + ,vAuction SMALLINT + ,vPackage INT +) +BEGIN +/** + * Añade un nuevo lote, genera su código de barras y + * inserta/actualiza el registro en la tabla #vn2008.buy_edi + */ + DECLARE vEdi INT; + DECLARE vRewriteKop INT DEFAULT NULL; + DECLARE vBarcode CHAR(15) DEFAULT NULL; + DECLARE vIsDuplicated BOOLEAN DEFAULT FALSE; + DECLARE vUpdateExistent BOOLEAN DEFAULT FALSE; + + DECLARE CONTINUE HANDLER FOR 1062 -- ER_DUP_KEY + SET vIsDuplicated = TRUE; + + -- Genera el código de barras + + IF vAgj != 0 AND vAgj IS NOT NULL + THEN + SET vBarcode = CONCAT( + LPAD(vAuction, 2, 0), + LPAD(IFNULL(vClock, 99), 2, 0), + LPAD(DAYOFYEAR(vDate), 3, 0), + IF(vClock IS NULL OR vClock = 99, + LPAD(vAgj, 7, 0), + CONCAT(LPAD(vAgj, 5, 0), '01') + ), + '0' + ); + END IF; + + -- Reescribe el parámetro kop + + IF vKop IS NULL + THEN + SELECT default_kop INTO vKop FROM config; + END IF; + + SELECT e.kop INTO vRewriteKop + FROM mail e + JOIN message m ON m.sender_id = e.id + WHERE m.id = vMessage; + + SET vKop = IFNULL(vRewriteKop, vKop); + + -- Inserta el nuevo EKT + + INSERT INTO vn2008.buy_edi SET + barcode = IFNULL(vBarcode, barcode) + ,delivery_number = vDeliveryNumber + ,entry_year = YEAR(vDate) + ,fec = vDate + ,hor = vHour + ,ref = vRef + ,item = vItem + ,agj = vAgj + ,cat = vCat + ,pac = vPac + ,sub = vSub + ,kop = vKop + ,ptd = vPtd + ,pro = vPro + ,ori = vOrigin + ,ptj = vPtj + ,qty = vQuantiy + ,pri = vPrice + ,klo = vClock + ,s1 = vS1 + ,s2 = vS2 + ,s3 = vS3 + ,s4 = vS4 + ,s5 = vS5 + ,s6 = vS6 + ,k01 = vK1 + ,k02 = vK2 + ,k03 = vP1 + ,k04 = vP2 + ,auction = vAuction + ,package = vPackage; + + + -- Si el EKT está duplicado y el que habia en la tabla era uno + -- provisional, lo actualiza con los nuevos valores. + + IF NOT vIsDuplicated + THEN + SET vEdi = LAST_INSERT_ID(); + CALL ediLoad (vEdi); + + ELSEIF vDeliveryNumber != 0 + AND vDeliveryNumber IS NOT NULL + THEN + SELECT id INTO vEdi + FROM vn2008.buy_edi + WHERE delivery_number = vDeliveryNumber; + + SELECT COUNT(*) = 0 INTO vUpdateExistent + FROM vn2008.buy_edi e + JOIN batch b ON b.buy_edi_id = e.id + JOIN config c + WHERE e.delivery_number = vDeliveryNumber + AND b.type_id != c.presale_id; + END IF; + + IF vUpdateExistent + THEN + UPDATE vn2008.buy_edi SET + barcode = IFNULL(vBarcode, barcode) + ,fec = vDate + ,hor = vHour + ,ref = vRef + ,item = vItem + ,agj = vAgj + ,cat = vCat + ,pac = vPac + ,sub = vSub + ,kop = vKop + ,ptd = vPtd + ,pro = vPro + ,ori = vOrigin + ,ptj = vPtj + ,qty = vQuantiy + ,pri = vPrice + ,klo = vClock + ,s1 = vS1 + ,s2 = vS2 + ,s3 = vS3 + ,s4 = vS4 + ,s5 = vS5 + ,s6 = vS6 + ,k01 = vK1 + ,k02 = vK2 + ,k03 = vP1 + ,k04 = vP2 + ,auction = vAuction + ,package = vPackage + WHERE id = vEdi; + END IF; + + -- Registra el lote + + INSERT INTO batch SET + message_id = vMessage + ,type_id = vType + ,buy_edi_id = vEdi; +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 DROP PROCEDURE IF EXISTS `ediLoad` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ediLoad`(vEdi INT) +BEGIN + DECLARE vRef INT; + DECLARE vBuy INT; + DECLARE vItem INT; + DECLARE vQty INT; + DECLARE vPackage INT; + DECLARE vIsLot BOOLEAN; + + -- Carga los datos necesarios del EKT + + SELECT ref, qty, package INTO vRef, vQty, vPackage + FROM vn2008.buy_edi e + LEFT JOIN item i ON e.ref = i.id + WHERE e.id = vEdi; + + -- Inserta el cubo si no existe + + IF vPackage = 800 + THEN + SET vPackage = 800 + vQty; + + INSERT IGNORE INTO vn2008.Cubos SET + Id_Cubo = vPackage, + x = 7200 / vQty, + y = 1; + ELSE + INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) + SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) + FROM bucket WHERE bucket_id = vPackage; + + IF ROW_COUNT() > 0 + THEN + INSERT INTO vn2008.mail SET + `subject` = 'Cubo añadido', + `text` = CONCAT('Se ha añadido el cubo: ', vPackage), + `to` = 'ekt@verdnatura.es'; + END IF; + END IF; + + -- Intenta obtener el artículo en base a los atributos holandeses + + INSERT IGNORE INTO item_track SET + item_id = vRef; + + SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem + FROM vn2008.buy_edi e + JOIN item_track t ON t.item_id = e.ref + LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref + LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id + JOIN vn2008.config cfg + WHERE e.id = vEdi + AND l.id != vEdi + AND c.Id_Article != cfg.generic_item + 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) + AND IF(t.s4, l.s4 = e.s4, TRUE) + AND IF(t.s5, l.s5 = e.s5, TRUE) + AND IF(t.s6, l.s6 = e.s6, TRUE) + AND IF(t.kop, l.kop = e.kop, TRUE) + AND IF(t.pac, l.pac = e.pac, TRUE) + AND IF(t.cat, l.cat = e.cat, TRUE) + AND IF(t.ori, l.ori = e.ori, TRUE) + AND IF(t.pro, l.pro = e.pro, TRUE) + AND IF(t.sub, l.sub = e.sub, TRUE) + AND IF(t.package, l.package = e.package, TRUE) + AND c.Id_Article < 170000 + ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; + + -- Determina si el articulo se vende por lotes + + IF vItem + THEN + SELECT COUNT(*) > 0 INTO vIsLot + FROM vn2008.Articles a + LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id + WHERE a.Id_Article = vItem + AND t.`transaction`; + + -- Si el articulo se vende por lotes se inserta un nuevo artículo + + IF vIsLot + THEN + INSERT INTO vn2008.Articles ( + Article + ,Medida + ,Categoria + ,Id_Origen + ,iva_group_id + ,Foto + ,Color + ,Codintrastat + ,tipo_id + ,Tallos + ) + SELECT + i.`name` + ,IFNULL(e.s1, e.pac) + ,e.cat + ,IFNULL(o.id, 17) + ,IFNULL(a.iva_group_id, 1) + ,a.Foto + ,a.Color + ,a.Codintrastat + ,IFNULL(a.tipo_id, 10) + ,IF(a.tipo_id = 15, 0, 1) + FROM vn2008.buy_edi e + LEFT JOIN item i ON i.id = e.ref + LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori + LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem + WHERE e.id = vEdi; + + SET vItem = LAST_INSERT_ID(); + END IF; + END IF; + + -- Inserta la compra asociada al EKT + + INSERT INTO vn2008.Compres + ( + Id_Entrada + ,buy_edi_id + ,Costefijo + ,Id_Article + ,grouping + ,caja + ,Packing + ,Cantidad + ,Productor + ,Etiquetas + ,Id_Cubo + ) + SELECT + cfg.edi_entry + ,vEdi + ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri + ,IFNULL(vItem, cfg.generic_item) + ,IFNULL(c.grouping, e.pac) + ,IFNULL(c.caja, TRUE) + ,@pac := e.pac / @t + ,@pac * e.qty + ,s.company_name + ,e.qty + ,IFNULL(c.Id_Cubo, e.package) + FROM vn2008.buy_edi e + LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy + LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article + LEFT JOIN supplier s ON e.pro = s.supplier_id + JOIN vn2008.config cfg + WHERE e.id = vEdi + LIMIT 1; +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 DROP PROCEDURE IF EXISTS `messageNew` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `messageNew`( + vMailId VARCHAR(100) + ,vSender VARCHAR(150) + ,OUT vMessageId INT +) +BEGIN +/** + * Registra un correo electronico. + * + * @param vMailId Message-ID del correo electrónico + * @param vSender Id del correo electrónio del remitente + */ + DECLARE vSenderId INT; + + SELECT id INTO vSenderId FROM mail + WHERE mail = vSender; + + INSERT IGNORE INTO message SET + sender_id = vSenderId + ,mail_id = vMailId; + + SET vMessageId = LAST_INSERT_ID(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55011,18 +56124,19 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bs` /*!40100 DEFAULT CHARACTER SET utf USE `bs`; -- --- Temporary view structure for view `VentasPorCliente` +-- Temporary table structure for view `VentasPorCliente` -- DROP TABLE IF EXISTS `VentasPorCliente`; /*!50001 DROP VIEW IF EXISTS `VentasPorCliente`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `VentasPorCliente` AS SELECT - 1 AS `Id_Cliente`, - 1 AS `VentaBasica`, - 1 AS `year`, - 1 AS `month`*/; +/*!50001 CREATE TABLE `VentasPorCliente` ( + `Id_Cliente` tinyint NOT NULL, + `VentaBasica` tinyint NOT NULL, + `year` tinyint NOT NULL, + `month` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -55142,6 +56256,7 @@ CREATE TABLE `manaCustomer` ( `Mana` decimal(10,0) NOT NULL DEFAULT '0', `dated` date NOT NULL, PRIMARY KEY (`Id_Cliente`,`dated`), + KEY `manaCustomerIdx1` (`dated`), CONSTRAINT `cliente_fk` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -55204,7 +56319,7 @@ CREATE TABLE `nightTask` ( `schema` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `procedure` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -55256,20 +56371,21 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `v_ventas` +-- Temporary table structure for view `v_ventas` -- DROP TABLE IF EXISTS `v_ventas`; /*!50001 DROP VIEW IF EXISTS `v_ventas`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ventas` AS SELECT - 1 AS `importe`, - 1 AS `recargo`, - 1 AS `year`, - 1 AS `month`, - 1 AS `week`, - 1 AS `day`*/; +/*!50001 CREATE TABLE `v_ventas` ( + `importe` tinyint NOT NULL, + `recargo` tinyint NOT NULL, + `year` tinyint NOT NULL, + `month` tinyint NOT NULL, + `week` tinyint NOT NULL, + `day` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -55335,6 +56451,20 @@ CREATE TABLE `ventas` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `ventasComponentes` +-- + +DROP TABLE IF EXISTS `ventasComponentes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ventasComponentes` ( + `Fecha` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '', + `Id_Componente` int(11) NOT NULL, + `Importe` decimal(10,2) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `ventas_contables` -- @@ -55355,9 +56485,139 @@ CREATE TABLE `ventas_contables` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Dumping events for database 'bs' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `nightly_tasks` */; +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 = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightly_tasks` ON SCHEDULE EVERY 1 DAY STARTS '2017-08-27 01:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL bs.nightTaskLauncher() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +/*!50106 DROP EVENT IF EXISTS `nightly_tasks2` */;; +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 = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightly_tasks2` ON SCHEDULE EVERY 1 DAY STARTS '2017-03-24 02:00:00' ON COMPLETION NOT PRESERVE ENABLE DO call bs.nightTaskLauncher() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +/*!50106 DROP EVENT IF EXISTS `nightly_tasks3` */;; +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 = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightly_tasks3` ON SCHEDULE EVERY 1 DAY STARTS '2017-03-24 03:00:00' ON COMPLETION NOT PRESERVE ENABLE DO call bs.nightTaskLauncher() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +/*!50106 DROP EVENT IF EXISTS `nightly_tasks4` */;; +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 = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `nightly_tasks4` ON SCHEDULE EVERY 1 DAY STARTS '2017-03-24 04:00:00' ON COMPLETION NOT PRESERVE ENABLE DO call bs.nightTaskLauncher() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + -- -- Dumping routines for database 'bs' -- +/*!50003 DROP PROCEDURE IF EXISTS `analisisComponentes` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `analisisComponentes`() +BEGIN + +DECLARE vDateStart DATE DEFAULT '2016-01-01'; +DECLARE vDateEnd DATE DEFAULT '2016-11-30'; +DECLARE vDate DATE; + +SET vDate = vDateStart; + +DELETE FROM bs.ventasComponentes; + +WHILE vDate <= vDateEnd DO + + INSERT INTO bs.ventasComponentes + SELECT vDate as Fecha, mc.Id_Componente, cast(sum(m.Cantidad * mc.Valor) AS DECIMAL(10,2)) as Importe + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + JOIN bs.ventas v ON v.Id_Movimiento = mc.Id_Movimiento + WHERE v.fecha = vDate + AND empresa_id IN (442,567) + GROUP BY mc.Id_Componente; + + SET vDate = TIMESTAMPADD(DAY,1,vDate); + + IF DAY(vDate) MOD 28 = 0 THEN + + SELECT vDate; + + END IF; + +END WHILE; + + SELECT vDate; + + +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 DROP PROCEDURE IF EXISTS `bancos_evolution_add` */; ALTER DATABASE `bs` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -55513,43 +56773,43 @@ ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `campaignComparative`(vDateFrom DATE, vDateTo DATE) BEGIN - SELECT - workerName, - id, - name, - CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, - CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount - FROM ( - (SELECT - CONCAT(w.firstname, ' ', w.name) AS workerName, - c.id, - c.name, - SUM(v.importe) AS previousAmmount, - 0 currentAmmount - FROM bs.ventas v - INNER JOIN vn.`client` c ON v.Id_Cliente = c.id - INNER JOIN vn.worker w ON c.workerFk = w.id - WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) - AND DATE_ADD(vDateTo, INTERVAL - 1 YEAR) - GROUP BY w.id, v.Id_Cliente) - UNION ALL - (SELECT - CONCAT(w.firstname, ' ', w.name) AS workerName, - c.id, - c.name, - 0 AS previousAmmount, - SUM(s.quantity * s.price) AS currentAmmount - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.worker w ON c.workerFk = w.id - WHERE t.shipped BETWEEN vDateFrom - AND vDateTo - GROUP BY w.id, c.id) - ) comparative - GROUP BY workerName, id - HAVING (previousAmmount <> 0 OR currentAmmount <> 0) - ORDER BY workerName, id; + SELECT + workerName, + id, + name, + CAST(SUM(previousAmmount) AS DECIMAL(10, 0)) AS previousAmmount, + CAST(SUM(currentAmmount) AS DECIMAL(10, 0)) AS currentAmmount + FROM ( + (SELECT + CONCAT(w.firstname, ' ', w.name) AS workerName, + c.id, + c.name, + SUM(v.importe) AS previousAmmount, + 0 currentAmmount + FROM bs.ventas v + INNER JOIN vn.`client` c ON v.Id_Cliente = c.id + INNER JOIN vn.worker w ON c.salesPersonFk = w.id + WHERE v.fecha BETWEEN DATE_ADD(vDateFrom, INTERVAL - 1 YEAR) + AND DATE_ADD(vDateTo, INTERVAL - 1 YEAR) + GROUP BY w.id, v.Id_Cliente) + UNION ALL + (SELECT + CONCAT(w.firstname, ' ', w.name) AS workerName, + c.id, + c.name, + 0 AS previousAmmount, + SUM(s.quantity * s.price) AS currentAmmount + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.worker w ON c.salesPersonFk = w.id + WHERE t.shipped BETWEEN vDateFrom + AND vDateTo + GROUP BY w.id, c.id) + ) comparative + GROUP BY workerName, id + HAVING (previousAmmount <> 0 OR currentAmmount <> 0) + ORDER BY workerName, id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55602,6 +56862,12 @@ ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `comercialesCompleto`(IN vWorker INT) BEGIN +create TEMPORARY TABLE workerAndBelow ENGINE=MEMORY + +SELECT w.id + FROM vn.worker w + WHERE w.bossFk=vWorker OR w.id=vWorker; + SELECT c.Id_Cliente id_cliente, @@ -55642,16 +56908,12 @@ FROM LEFT JOIN bi.claims_ratio cr on cr.Id_Cliente = c.Id_Cliente LEFT JOIN - (SELECT - v.Id_Cliente, SUM(importe) c365 - FROM - bs.ventas v - INNER JOIN vn2008.Clientes c USING (Id_Cliente) - LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador - WHERE - (c.Id_Trabajador = vWorker OR tr.boss = vWorker) - AND v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, CURDATE()) AND CURDATE() - GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente + (SELECT v.Id_Cliente, SUM(importe) c365 -- optimizat de 6s /5.3s/ 4.7s a 0.3/0.4/0.3 + FROM bs.ventas v + JOIN vn2008.Clientes c USING (Id_Cliente) + JOIN workerAndBelow w ON w.id = c.Id_Trabajador + WHERE v.fecha BETWEEN TIMESTAMPADD(YEAR, - 1, CURDATE()) AND CURDATE() + GROUP BY v.Id_Cliente) c365 ON c365.Id_Cliente = c.Id_Cliente LEFT JOIN (SELECT Id_Cliente, SUM(importe) consumo @@ -55712,7 +56974,7 @@ FROM GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker); - +DROP TEMPORARY TABLE workerAndBelow; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56195,7 +57457,7 @@ BEGIN SET started = now() WHERE id = vId; - CALL vn2008.sql_query (sql_printf('CALL %s.%s',vSchema, vProcedure)); + CALL util.exec (sql_printf('CALL %s.%s',vSchema, vProcedure)); UPDATE bs.nightTask SET finished = now() @@ -56448,7 +57710,7 @@ ALTER DATABASE `bs` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add`(IN datSTART DATE, IN datEND DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add`(IN datSTART DATETIME, IN datEND DATETIME) BEGIN @@ -56468,9 +57730,9 @@ WHILE vEndingDate <= datEND DO -- Ventes bioniques - SELECT vStartingDate,vEndingDate; + SELECT vStartingDate,vEndingDate, datEND; - INSERT INTO ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) + REPLACE ventas(Id_Movimiento, importe, recargo, fecha, tipo_id, Id_Cliente, empresa_id) SELECT Id_Movimiento , sum( IF(base, Cantidad * Valor, 0) ) as importe , sum( IF(base, 0, Cantidad * Valor) ) as recargo @@ -56514,10 +57776,7 @@ WHERE v.fecha between vStartingDate and vEndingDate; SET vStartingDate = TIMESTAMPADD(DAY,1, vStartingDate); SET vEndingDate = vn2008.dayend(vStartingDate); - IF CURDATE() = '2017-02-28' THEN - SELECT vStartingDate; - END IF; - + END WHILE; @@ -56543,7 +57802,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ventas_add_launcher`() BEGIN - call bs.ventas_add(timestampadd(week,-2,curdate()),curdate()); + call bs.ventas_add(timestampadd(week,-1,curdate()),curdate()); END ;; DELIMITER ; @@ -56717,274 +57976,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Current Database: `account` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `account` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; - -USE `account`; - --- --- Table structure for table `account` --- - -DROP TABLE IF EXISTS `account`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account` ( - `id` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `account_ibfk_3` FOREIGN KEY (`id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Users allowed to have an account'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `accountConfig` --- - -DROP TABLE IF EXISTS `accountConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `accountConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `homedir` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The base folder for users home directories', - `shell` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The default shell', - `min` smallint(6) NOT NULL, - `max` smallint(6) NOT NULL, - `warn` smallint(6) NOT NULL, - `inact` smallint(6) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `accountDovecot` --- - -DROP TABLE IF EXISTS `accountDovecot`; -/*!50001 DROP VIEW IF EXISTS `accountDovecot`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `accountDovecot` AS SELECT - 1 AS `name`, - 1 AS `password`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `accountLog` --- - -DROP TABLE IF EXISTS `accountLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `accountLog` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `msg` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `pid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `rhost` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `time` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `accountNss` --- - -DROP TABLE IF EXISTS `accountNss`; -/*!50001 DROP VIEW IF EXISTS `accountNss`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `accountNss` AS SELECT - 1 AS `surname`, - 1 AS `name`, - 1 AS `password`, - 1 AS `home`, - 1 AS `shell`, - 1 AS `min`, - 1 AS `max`, - 1 AS `warn`, - 1 AS `inact`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `accountPam` --- - -DROP TABLE IF EXISTS `accountPam`; -/*!50001 DROP VIEW IF EXISTS `accountPam`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `accountPam` AS SELECT - 1 AS `name`, - 1 AS `password`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `ldapConfig` --- - -DROP TABLE IF EXISTS `ldapConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ldapConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The hostname of LDAP server', - `rdn` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The LDAP user', - `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Base64 encoded password', - `baseDn` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The base DN to do the query', - `filter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Filter to apply to the query', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='LDAP server configuration parameters'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mailAlias` --- - -DROP TABLE IF EXISTS `mailAlias`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mailAlias` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `alias` varchar(50) CHARACTER SET utf8 NOT NULL, - `isPublic` tinyint(4) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `alias` (`alias`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail aliases'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mailAliasAccount` --- - -DROP TABLE IF EXISTS `mailAliasAccount`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mailAliasAccount` ( - `mailAlias` int(10) unsigned NOT NULL, - `account` int(10) unsigned NOT NULL, - PRIMARY KEY (`mailAlias`,`account`), - KEY `account` (`account`), - CONSTRAINT `account` FOREIGN KEY (`account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `mailAlias` FOREIGN KEY (`mailAlias`) REFERENCES `mailAlias` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail alias that is assigned to each account'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mailForward` --- - -DROP TABLE IF EXISTS `mailForward`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mailForward` ( - `account` int(10) unsigned NOT NULL, - `forwardTo` varchar(250) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`account`), - CONSTRAINT `mailForward_ibfk_1` FOREIGN KEY (`account`) REFERENCES `account` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Mail forwarding'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `role` --- - -DROP TABLE IF EXISTS `role`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `role` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(14) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `hasLogin` tinyint(3) unsigned NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Roles'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `roleInherit` --- - -DROP TABLE IF EXISTS `roleInherit`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `roleInherit` ( - `role` int(10) unsigned NOT NULL, - `inheritsFrom` int(10) unsigned NOT NULL, - PRIMARY KEY (`role`,`inheritsFrom`), - KEY `owner_id` (`inheritsFrom`), - CONSTRAINT `roleInherit_ibfk_1` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `roleInherit_ibfk_2` FOREIGN KEY (`inheritsFrom`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Role inheritance'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `roleRole` --- - -DROP TABLE IF EXISTS `roleRole`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `roleRole` ( - `role` int(10) unsigned NOT NULL, - `inheritsFrom` int(10) unsigned NOT NULL, - UNIQUE KEY `role` (`role`,`inheritsFrom`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Calculated role inheritance'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sambaConfig` --- - -DROP TABLE IF EXISTS `sambaConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sambaConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The hosname of Samba server', - `sshUser` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The SSH user to connect to servers', - `sshPass` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The SSH password base64 encoded', - `domain` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The default domain for mail accounts, its appended to the user name', - `uidBase` int(10) unsigned NOT NULL DEFAULT '10000' COMMENT 'The base for Unix uids', - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration parameters for accounts'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `user` --- - -DROP TABLE IF EXISTS `user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `user` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(30) CHARACTER SET utf8 NOT NULL, - `password` char(64) COLLATE utf8_unicode_ci NOT NULL, - `role` int(10) unsigned NOT NULL DEFAULT '2', - `active` tinyint(1) NOT NULL DEFAULT '1', - `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `sync` tinyint(4) NOT NULL DEFAULT '0', - `recoverPass` tinyint(3) unsigned NOT NULL DEFAULT '1', - `lastPassChange` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`), - KEY `role` (`role`), - KEY `email` (`email`), - CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; -/*!40101 SET character_set_client = @saved_cs_client */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `vivosMuertos` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -56994,349 +57986,957 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`userBeforeInsert` -BEFORE INSERT ON `user` FOR EACH ROW +CREATE DEFINER=`root`@`%` PROCEDURE `vivosMuertos`() BEGIN - CALL userCheckName (NEW.`name`); -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `account`.`userBeforeUpdate` -BEFORE UPDATE ON `user` FOR EACH ROW -BEGIN - IF OLD.`name` != NEW.`name` THEN - CALL userCheckName (NEW.`name`); - END IF; - IF NEW.`password` != OLD.`password` - OR (OLD.`password` IS NULL AND NEW.`password` IS NOT NULL) - THEN - SET NEW.lastPassChange = NOW(); - 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `userAfterUpdate` -AFTER UPDATE ON `user` FOR EACH ROW -BEGIN - IF NEW.role <> OLD.role - THEN - INSERT INTO vn2008.mail(`to`,reply_to,`subject`,`text`) - SELECT 'jgallego@verdnatura.es','jgallego@verdnatura.es','Rol modificado', - CONCAT(`name`,' ha modificado el rol del usuario ',NEW.`name`,' de ',OLD.role,' a ',NEW.role) - FROM account.user WHERE id = account.userGetId(); - 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +SET @datSTART = TIMESTAMPADD(YEAR,-2,CURDATE()); +SET @datEND = TIMESTAMPADD(DAY,-DAY(CURDATE()),CURDATE()); --- --- Table structure for table `userPassword` --- +DROP TEMPORARY TABLE IF EXISTS tmp.VivosMuertos; -DROP TABLE IF EXISTS `userPassword`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `userPassword` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `length` tinyint(3) unsigned NOT NULL, - `nAlpha` tinyint(3) unsigned NOT NULL, - `nUpper` tinyint(3) unsigned NOT NULL, - `nDigits` tinyint(3) unsigned NOT NULL, - `nPunct` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Restrictions on user passwords'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `userRole` --- - -DROP TABLE IF EXISTS `userRole`; -/*!50001 DROP VIEW IF EXISTS `userRole`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `userRole` AS SELECT - 1 AS `id`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `userSession` --- - -DROP TABLE IF EXISTS `userSession`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `userSession` ( - `connectionId` int(10) unsigned NOT NULL, - `user` int(10) unsigned NOT NULL, - `userName` varchar(30) CHARACTER SET utf8 DEFAULT NULL, - `creationDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`connectionId`), - KEY `creationDate` (`creationDate`) -) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `userView` --- - -DROP TABLE IF EXISTS `userView`; -/*!50001 DROP VIEW IF EXISTS `userView`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `userView` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `active`, - 1 AS `email`, - 1 AS `role`, - 1 AS `recoverPass`*/; -SET character_set_client = @saved_cs_client; - --- --- Dumping routines for database 'account' --- -/*!50003 DROP FUNCTION IF EXISTS `toUnixDays` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `toUnixDays`(vDate DATE) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Devuelve el timestamp unix en días de una fecha. - * - * @param vData La fecha - * @return Unix timestamp en días - */ - RETURN UNIX_TIMESTAMP(vDate) DIV 86400; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP FUNCTION IF EXISTS `userGetId` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `userGetId`() RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Devuelve el identificador del usuario actual. - * - * @return El id del usuario - */ - DECLARE vUser INT DEFAULT NULL; - - SELECT user INTO vUser FROM userSession - WHERE connectionId = CONNECTION_ID(); - - IF vUser IS NULL THEN - SELECT id INTO vUser FROM user - WHERE name = LEFT(USER(), INSTR(USER(), '@') - 1); - END IF; - - RETURN vUser; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP FUNCTION IF EXISTS `userGetMysqlRole` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `userGetMysqlRole`(vUserName VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 -BEGIN -/** - * A partir de un nombre de usuario devuelve el rol - * de MySQL asociado y con el que deberia autenticarse - * cuando se utilice sistemas de autenticación externos. - * - * @param vUserName El nombre de usuario - * @return El rol de MySQL asociado - */ - DECLARE vRole VARCHAR(255); - - SELECT CONCAT(IF(r.hasLogin, 'z-', ''), r.name) INTO vRole - FROM role r - JOIN user u ON u.role = r.id - WHERE u.name = vUserName; - - RETURN vRole; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP FUNCTION IF EXISTS `userGetName` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `userGetName`() RETURNS varchar(30) CHARSET utf8 - DETERMINISTIC -BEGIN -/** - * Devuelve el nombre del usuario actual. - * - * @return El nombre de usuario - */ - DECLARE vUser VARCHAR(30) DEFAULT NULL; - - -- FIXME: Esta consulta bloquea la base de datos - SELECT userName INTO vUser - FROM userSession - WHERE connectionId = CONNECTION_ID(); - - IF vUser IS NULL THEN - SET vUser = LEFT(USER(), INSTR(USER(), '@') - 1); - END IF; - - RETURN vUser; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP FUNCTION IF EXISTS `userGetNameFromId` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `userGetNameFromId`(vId INT) RETURNS varchar(30) CHARSET utf8 -BEGIN -/** - * Obtener nombre de usuari a partir de su id - * - * @param vId Id del usuario - * @return Nombre de usuario - */ - DECLARE vName VARCHAR(30); - - SELECT `name` INTO vName - FROM user - WHERE id = vId; - - RETURN vName; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP FUNCTION IF EXISTS `userHasRole` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `userHasRole`(vRoleName VARCHAR(255)) RETURNS tinyint(1) - DETERMINISTIC -BEGIN -/** - * Comprueba si el usuario actual tiene asociado un rol. - * - * @param vRoleName Nombre del rol a comprobar - * @return %TRUE si tiene el rol, %FALSE en caso contrario - */ - DECLARE vRoleId INT; - - SELECT id INTO vRoleId - FROM role - WHERE `name` = vRoleName COLLATE 'utf8_unicode_ci'; +CREATE TEMPORARY TABLE tmp.VivosMuertos +SELECT c.Id_Cliente, tm.yearMonth, f.Compra, 0 as Nuevo, 0 as Muerto +FROM vn2008.Clientes c +JOIN (SELECT DISTINCT yearMonth FROM vn2008.time WHERE date BETWEEN @datSTART AND @datEND ) tm +LEFT JOIN + (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra + FROM vn2008.Facturas f + JOIN vn2008.time tm ON tm.date = f.Fecha + WHERE Fecha BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; - RETURN userHasRoleId (vRoleId); +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 AND fm.Id_Cliente = vm.Id_Cliente +SET Nuevo = 1; + +SELECT max(yearMonth) INTO @lastYearMonth FROM tmp.VivosMuertos; + +UPDATE tmp.VivosMuertos vm +JOIN ( + SELECT MAX(tm.yearMonth) firstMonth, 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 AND fm.Id_Cliente = vm.Id_Cliente +SET Muerto = 1 +WHERE yearMonth < @lastYearMonth; + + SELECT * FROM tmp.VivosMuertos; + 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP FUNCTION IF EXISTS `userHasRoleId` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; + +-- +-- Current Database: `bi` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `bi`; + +-- +-- Table structure for table `Equalizator` +-- + +DROP TABLE IF EXISTS `Equalizator`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Equalizator` ( + `Vista` int(11) NOT NULL, + `Pedido` int(11) DEFAULT NULL, + `Impreso` int(11) DEFAULT NULL, + `Encajado` int(11) DEFAULT NULL, + PRIMARY KEY (`Vista`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Greuge_Evolution` +-- + +DROP TABLE IF EXISTS `Greuge_Evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Greuge_Evolution` ( + `Id_Cliente` int(11) NOT NULL, + `Fecha` date NOT NULL, + `Greuge` decimal(10,2) NOT NULL DEFAULT '0.00', + `Ventas` decimal(10,2) NOT NULL DEFAULT '0.00', + `Fosil` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'greuge fósil, correspondiente a los clientes muertos', + `Recobro` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`Id_Cliente`,`Fecha`), + KEY `greuge_evolution_idx1` (`Fecha`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacenamos la evolucion del greuge de los ultimos dias '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Greuge_comercial_recobro` +-- + +DROP TABLE IF EXISTS `Greuge_comercial_recobro`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Greuge_comercial_recobro` ( + `Id_Trabajador` int(11) NOT NULL, + `recobro` decimal(10,2) NOT NULL DEFAULT '0.00', + `peso_cartera` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`Id_Trabajador`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Greuges_comercial_detail` +-- + +DROP TABLE IF EXISTS `Greuges_comercial_detail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Greuges_comercial_detail` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Id_Trabajador` int(10) unsigned NOT NULL, + `Comentario` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `Importe` decimal(10,2) NOT NULL, + `Fecha` datetime DEFAULT NULL, + PRIMARY KEY (`Id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Last_buy_id` +-- + +DROP TABLE IF EXISTS `Last_buy_id`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Last_buy_id` ( + `Id_Article` int(11) NOT NULL DEFAULT '90', + `Id_Compra` int(11) NOT NULL DEFAULT '0', + `warehouse_id` smallint(6) unsigned NOT NULL, + PRIMARY KEY (`warehouse_id`,`Id_Article`), + UNIQUE KEY `Id_Compra_UNIQUE` (`Id_Compra`), + CONSTRAINT `Id_CompraFK` FOREIGN KEY (`Id_Compra`) REFERENCES `vn2008`.`Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Last_buy_idBackUp` +-- + +DROP TABLE IF EXISTS `Last_buy_idBackUp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Last_buy_idBackUp` ( + `Id_Article` int(11) NOT NULL DEFAULT '90', + `Id_Compra` int(11) NOT NULL DEFAULT '0', + `warehouse_id` smallint(6) unsigned NOT NULL, + PRIMARY KEY (`Id_Article`,`warehouse_id`), + UNIQUE KEY `Id_Compra_UNIQUE` (`Id_Compra`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Radar` +-- + +DROP TABLE IF EXISTS `Radar`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Radar` ( + `Propio` int(1) NOT NULL DEFAULT '0', + `Credito` double NOT NULL DEFAULT '0', + `Riesgo` double(19,2) DEFAULT NULL, + `Greuge` double DEFAULT NULL, + `Id_Ticket` int(11) NOT NULL DEFAULT '0', + `wh` smallint(6) unsigned NOT NULL DEFAULT '1', + `Fecha` datetime NOT NULL, + `Alias` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `Vista` int(11) DEFAULT '0', + `Tipo` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'RECOGIDA', + `Id_Trabajador` int(11) DEFAULT '20', + `Solucion` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `Localizacion` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `Estado` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Fecha_Simple` date DEFAULT NULL, + `Id_Comercial` int(11) DEFAULT '20', + `Risk` double NOT NULL DEFAULT '0', + `Rojo` bigint(21) DEFAULT '0', + `Naranja` bigint(21) DEFAULT '0', + `Amarillo` bigint(21) DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `Ticket_Portes` +-- + +DROP TABLE IF EXISTS `Ticket_Portes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `Ticket_Portes` ( + `Id_Ticket` int(11) NOT NULL, + `rate` tinyint(4) NOT NULL COMMENT 'Tarifa', + `real_amount` double NOT NULL COMMENT 'Cantidad pactada con la agencia', + `payed_amount` double NOT NULL COMMENT 'Cantidad reflejada en el Ticket', + PRIMARY KEY (`Id_Ticket`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `VelocityKK` +-- + +DROP TABLE IF EXISTS `VelocityKK`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `VelocityKK` ( + `tipo_id` int(11) NOT NULL, + `Fecha` datetime NOT NULL, + `Disponible` int(11) DEFAULT NULL, + `Visible` int(11) DEFAULT NULL, + `velocity_id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`velocity_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `XDiario_ALL` +-- + +DROP TABLE IF EXISTS `XDiario_ALL`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `XDiario_ALL` ( + `empresa_id` int(5) NOT NULL, + `SUBCTA` varchar(11) COLLATE utf8_unicode_ci NOT NULL, + `Eurodebe` double DEFAULT NULL, + `Eurohaber` double DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `FECHA_EX` date DEFAULT NULL, + KEY `Cuenta` (`SUBCTA`), + KEY `empresa` (`empresa_id`), + KEY `Fecha` (`Fecha`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_grafico_simple` +-- + +DROP TABLE IF EXISTS `analisis_grafico_simple`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_grafico_simple` ( + `Año` smallint(5) unsigned NOT NULL, + `Semana` tinyint(3) unsigned NOT NULL, + `Importe` double DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `analisis_grafico_ventas` +-- + +DROP TABLE IF EXISTS `analisis_grafico_ventas`; +/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `analisis_grafico_ventas` ( + `Año` tinyint NOT NULL, + `Semana` tinyint NOT NULL, + `Importe` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `analisis_ventas` +-- + +DROP TABLE IF EXISTS `analisis_ventas`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas` ( + `Familia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `Reino` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `Comercial` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `Comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `Provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `Año` smallint(5) unsigned NOT NULL, + `Mes` tinyint(3) unsigned NOT NULL, + `Semana` tinyint(3) unsigned NOT NULL, + `Vista` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `Importe` double NOT NULL, + KEY `Año` (`Año`,`Semana`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_ventas_almacen_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_almacen_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_almacen_evolution` ( + `Semana` int(11) NOT NULL, + `Almacen` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `Ventas` int(11) NOT NULL, + `Año` int(11) NOT NULL, + `Periodo` int(11) NOT NULL, + KEY `Almacen` (`Almacen`,`Periodo`), + KEY `Periodo` (`Periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_ventas_comprador_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_comprador_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_comprador_evolution` ( + `semana` int(11) NOT NULL, + `comprador` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `ventas` int(11) NOT NULL, + `año` int(11) NOT NULL, + `periodo` int(11) NOT NULL, + UNIQUE KEY `comprador` (`comprador`,`periodo`), + KEY `periodo` (`periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_ventas_familia_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_familia_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_familia_evolution` ( + `semana` int(11) NOT NULL, + `familia` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `ventas` int(11) NOT NULL, + `año` int(11) NOT NULL, + `periodo` int(11) NOT NULL, + KEY `familia` (`familia`,`periodo`), + KEY `periodo` (`periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_ventas_provincia_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_provincia_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_provincia_evolution` ( + `semana` int(11) NOT NULL, + `provincia` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `ventas` int(11) NOT NULL, + `año` int(11) NOT NULL, + `periodo` int(11) NOT NULL, + UNIQUE KEY `provincia` (`provincia`,`periodo`), + KEY `periodo` (`periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_ventas_reino_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_reino_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_reino_evolution` ( + `semana` int(11) NOT NULL, + `reino` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `ventas` int(11) NOT NULL, + `año` int(11) NOT NULL, + `periodo` int(11) NOT NULL, + UNIQUE KEY `reino` (`reino`,`periodo`), + KEY `periodo` (`periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `analisis_ventas_simple` +-- + +DROP TABLE IF EXISTS `analisis_ventas_simple`; +/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `analisis_ventas_simple` ( + `Año` tinyint NOT NULL, + `Semana` tinyint NOT NULL, + `Importe` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `analisis_ventas_vendedor_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_vendedor_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_vendedor_evolution` ( + `semana` int(11) NOT NULL, + `vendedor` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `ventas` int(11) NOT NULL, + `año` int(11) NOT NULL, + `periodo` int(11) NOT NULL, + UNIQUE KEY `vendedor` (`vendedor`,`periodo`), + KEY `periodo` (`periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `analisis_ventas_vista_evolution` +-- + +DROP TABLE IF EXISTS `analisis_ventas_vista_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `analisis_ventas_vista_evolution` ( + `semana` int(11) NOT NULL, + `vista` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `ventas` int(11) NOT NULL, + `año` int(11) NOT NULL, + `periodo` int(11) NOT NULL, + UNIQUE KEY `vista` (`vista`,`periodo`), + KEY `periodo` (`periodo`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calidad_detalle` +-- + +DROP TABLE IF EXISTS `calidad_detalle`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calidad_detalle` ( + `Id_Cliente` int(11) NOT NULL, + `calidad_parametros_id` int(2) NOT NULL, + `valor` int(3) DEFAULT NULL, + PRIMARY KEY (`Id_Cliente`,`calidad_parametros_id`), + KEY `calidad_parametros_detalle_idx` (`calidad_parametros_id`), + CONSTRAINT `calidad_parametros_detalle` FOREIGN KEY (`calidad_parametros_id`) REFERENCES `calidad_parametros` (`calidad_parametros_id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calidad_parametros` +-- + +DROP TABLE IF EXISTS `calidad_parametros`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calidad_parametros` ( + `calidad_parametros_id` int(2) NOT NULL, + `descripcion` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`calidad_parametros_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `claims_ratio` +-- + +DROP TABLE IF EXISTS `claims_ratio`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `claims_ratio` ( + `Id_Cliente` int(11) NOT NULL DEFAULT '0', + `Consumo` decimal(10,2) DEFAULT NULL, + `Reclamaciones` decimal(10,2) DEFAULT NULL, + `Ratio` decimal(5,2) DEFAULT NULL, + `recobro` decimal(5,2) DEFAULT NULL, + `inflacion` decimal(5,2) NOT NULL DEFAULT '1.00', + PRIMARY KEY (`Id_Cliente`), + CONSTRAINT `claims_ratio_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `comparativa_clientes` +-- + +DROP TABLE IF EXISTS `comparativa_clientes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `comparativa_clientes` ( + `Fecha` date NOT NULL DEFAULT '0000-00-00', + `Id_Cliente` int(11) NOT NULL DEFAULT '0', + `Propietario` int(11) DEFAULT NULL, + `titular` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `suplente` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `trabajador` int(11) DEFAULT NULL, + `actual` double DEFAULT NULL, + `pasado` double DEFAULT NULL, + `concepto` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '', + KEY `cc_data_indez` (`Fecha`), + KEY `cc_Id_Cliente_index` (`Id_Cliente`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `customerDebtInventory` +-- + +DROP TABLE IF EXISTS `customerDebtInventory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `customerDebtInventory` ( + `Id_Cliente` int(11) NOT NULL, + `Debt` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'CREATE TABLE bi.customerDebtInventory\n\nSELECT Id_Cliente, sum(Euros) as Debt\n\nFROM \n(\nSELECT Id_Cliente, Entregado as Euros\n\nFROM Recibos \n\nWHERE Fechacobro < ''2017-01-01\n''\nUNION ALL\n\nSELECT Id_Cliente, - Importe \nFROM Facturas\nWHERE Fecha < ''2017-01-01''\n) sub \nGROUP BY Id_Cliente', + PRIMARY KEY (`Id_Cliente`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `customerRiskOverdue` +-- + +DROP TABLE IF EXISTS `customerRiskOverdue`; +/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `customerRiskOverdue` ( + `customer_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `company_id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `customer_risk` +-- + +DROP TABLE IF EXISTS `customer_risk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `customer_risk` ( + `customer_id` int(11) NOT NULL DEFAULT '0', + `company_id` smallint(6) unsigned NOT NULL DEFAULT '0', + `amount` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`customer_id`,`company_id`), + KEY `company_id` (`company_id`), + CONSTRAINT `customer_risk_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `customer_risk_ibfk_2` FOREIGN KEY (`company_id`) REFERENCES `vn2008`.`empresa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Saldo de apertura < 2015-01-01'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dailyTaskLog` +-- + +DROP TABLE IF EXISTS `dailyTaskLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `dailyTaskLog` ( + `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `defaulters` +-- + +DROP TABLE IF EXISTS `defaulters`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `defaulters` ( + `client` int(11) NOT NULL, + `date` date NOT NULL, + `amount` double NOT NULL DEFAULT '0', + `defaulterSince` date DEFAULT NULL, + `hasChanged` tinyint(1) DEFAULT NULL, + PRIMARY KEY (`client`,`date`), + KEY `client` (`client`), + KEY `date` (`date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `defaulting` +-- + +DROP TABLE IF EXISTS `defaulting`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `defaulting` ( + `date` date NOT NULL, + `amount` double NOT NULL, + PRIMARY KEY (`date`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `f_tvc` +-- + +DROP TABLE IF EXISTS `f_tvc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `f_tvc` ( + `Id_Ticket` int(11) NOT NULL, + PRIMARY KEY (`Id_Ticket`), + CONSTRAINT `id_ticket_to_comisionantes` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacenamos la lista de tickets para agilizar la consulta. Corresponde a los clientes REAL y en los almacenes COMISIONANTES'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `facturacion_media_anual` +-- + +DROP TABLE IF EXISTS `facturacion_media_anual`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `facturacion_media_anual` ( + `Id_Cliente` int(11) NOT NULL, + `Consumo` double(17,0) DEFAULT NULL, + PRIMARY KEY (`Id_Cliente`), + CONSTRAINT `fmaId_Cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `last_Id_Cubo` +-- + +DROP TABLE IF EXISTS `last_Id_Cubo`; +/*!50001 DROP VIEW IF EXISTS `last_Id_Cubo`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `last_Id_Cubo` ( + `Id_Compra` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `Id_Cubo` tinyint NOT NULL, + `Packing` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `lastaction` +-- + +DROP TABLE IF EXISTS `lastaction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lastaction` ( + `Id_Cliente` int(11) unsigned NOT NULL, + `Cliente` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `Ultima_accion` date DEFAULT NULL, + `Comercial` varchar(3) CHARACTER SET utf8 DEFAULT NULL, + PRIMARY KEY (`Id_Cliente`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `live_counter` +-- + +DROP TABLE IF EXISTS `live_counter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `live_counter` ( + `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `amount` double NOT NULL, + PRIMARY KEY (`odbc_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mana_inventory_kk` +-- + +DROP TABLE IF EXISTS `mana_inventory_kk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mana_inventory_kk` ( + `Id_Trabajador` int(11) NOT NULL, + `mana` double NOT NULL DEFAULT '0', + `dated` date NOT NULL, + PRIMARY KEY (`Id_Trabajador`,`dated`), + CONSTRAINT `fk_trabajador_mana_inventory` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `movimientos_log` +-- + +DROP TABLE IF EXISTS `movimientos_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `movimientos_log` ( + `idmovimientos_log` int(11) NOT NULL AUTO_INCREMENT, + `Id_Movimiento` int(11) NOT NULL, + `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Id_Trabajador` int(11) NOT NULL, + `field_name` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `new_value` double DEFAULT NULL, + PRIMARY KEY (`idmovimientos_log`) +) ENGINE=InnoDB AUTO_INCREMENT=13371133 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `partitioning_information` +-- + +DROP TABLE IF EXISTS `partitioning_information`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `partitioning_information` ( + `schema_name` varchar(10) CHARACTER SET utf8 NOT NULL, + `table_name` varchar(20) CHARACTER SET utf8 NOT NULL, + `date_field` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `table_depending` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `execution_order` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`schema_name`,`table_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `primer_pedido` +-- + +DROP TABLE IF EXISTS `primer_pedido`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `primer_pedido` ( + `Id_Cliente` int(11) NOT NULL, + `Id_Ticket` int(11) NOT NULL, + `month` tinyint(1) NOT NULL, + `year` smallint(2) NOT NULL, + `total` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`Id_Cliente`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `rotacion` +-- + +DROP TABLE IF EXISTS `rotacion`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rotacion` ( + `Id_Article` int(11) NOT NULL, + `warehouse_id` smallint(6) unsigned NOT NULL, + `total` int(10) NOT NULL DEFAULT '0', + `rotacion` decimal(10,4) NOT NULL DEFAULT '0.0000', + `cm3` int(11) NOT NULL DEFAULT '0', + `almacenaje` decimal(10,4) NOT NULL DEFAULT '0.0000', + `manipulacion` decimal(10,4) NOT NULL DEFAULT '0.0000', + `auxiliar` decimal(10,4) NOT NULL DEFAULT '0.0000', + `mermas` decimal(10,4) NOT NULL DEFAULT '0.0000', + PRIMARY KEY (`Id_Article`,`warehouse_id`), + KEY `id_article_rotacion_idx` (`Id_Article`), + KEY `warehouse_id_rotacion_idx` (`warehouse_id`), + CONSTRAINT `id_article_rotaci` FOREIGN KEY (`Id_Article`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `warehouse_id_rotaci` FOREIGN KEY (`warehouse_id`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de rotacion en los ultimos 365 dias'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saldos_bancos` +-- + +DROP TABLE IF EXISTS `saldos_bancos`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saldos_bancos` ( + `Semana` int(2) NOT NULL, + `Mes` int(2) NOT NULL, + `Año` int(4) NOT NULL, + `Entrada` double DEFAULT NULL, + `Salida` decimal(32,2) DEFAULT NULL, + `Saldo` double DEFAULT NULL, + `Id_Banco` int(11) NOT NULL DEFAULT '0', + `empresa_id` int(5) unsigned NOT NULL DEFAULT '0', + `Empresa` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saldos_bancos_pordia` +-- + +DROP TABLE IF EXISTS `saldos_bancos_pordia`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saldos_bancos_pordia` ( + `Fecha` date NOT NULL, + `Entrada` double DEFAULT NULL, + `Salida` decimal(32,2) DEFAULT NULL, + `Saldo` double DEFAULT NULL, + `Id_Banco` int(11) NOT NULL DEFAULT '0', + `empresa_id` int(5) unsigned NOT NULL DEFAULT '0', + `Empresa` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', + `Año` int(4) NOT NULL, + `Mes` int(2) NOT NULL, + `Dia` int(2) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sales` +-- + +DROP TABLE IF EXISTS `sales`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sales` ( + `Id_Trabajador` int(10) unsigned NOT NULL, + `year` int(10) unsigned NOT NULL, + `month` int(10) unsigned NOT NULL, + `weight` int(11) NOT NULL DEFAULT '0', + `boss_aid` int(10) NOT NULL DEFAULT '0', + `boss_id` int(10) NOT NULL DEFAULT '0', + `comision` int(11) DEFAULT NULL, + PRIMARY KEY (`Id_Trabajador`,`year`,`month`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tarifa_componentes` +-- + +DROP TABLE IF EXISTS `tarifa_componentes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tarifa_componentes` ( + `Id_Componente` int(11) NOT NULL AUTO_INCREMENT, + `Componente` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `tarifa_componentes_series_id` int(11) NOT NULL, + `tarifa_class` smallint(6) DEFAULT NULL, + `tax` double DEFAULT NULL, + `is_renewable` tinyint(2) NOT NULL DEFAULT '1', + PRIMARY KEY (`Id_Componente`), + KEY `series_componentes_idx` (`tarifa_componentes_series_id`), + KEY `comp` (`tarifa_class`), + CONSTRAINT `serie_componente` FOREIGN KEY (`tarifa_componentes_series_id`) REFERENCES `tarifa_componentes_series` (`tarifa_componentes_series_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tarifa_componentes_series` +-- + +DROP TABLE IF EXISTS `tarifa_componentes_series`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tarifa_componentes_series` ( + `tarifa_componentes_series_id` int(11) NOT NULL AUTO_INCREMENT, + `Serie` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `base` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Marca aquellas series que se utilizan para calcular el precio base de las ventas, a efectos estadisticos', + `margen` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`tarifa_componentes_series_id`), + UNIQUE KEY `Serie_UNIQUE` (`Serie`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Permite organizar de forma ordenada los distintos componentes'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tarifa_premisas` +-- + +DROP TABLE IF EXISTS `tarifa_premisas`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tarifa_premisas` ( + `Id_Premisa` int(11) NOT NULL AUTO_INCREMENT, + `premisa` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`Id_Premisa`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tarifa_warehouse` +-- + +DROP TABLE IF EXISTS `tarifa_warehouse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tarifa_warehouse` ( + `Id_Tarifa_Warehouse` int(11) NOT NULL AUTO_INCREMENT, + `warehouse_id` int(11) NOT NULL, + `Id_Premisa` int(11) NOT NULL, + `Valor` double NOT NULL, + PRIMARY KEY (`Id_Tarifa_Warehouse`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los valores de gasto por almacen'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `v_clientes_jerarquia` +-- + +DROP TABLE IF EXISTS `v_clientes_jerarquia`; +/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v_clientes_jerarquia` ( + `Id_Cliente` tinyint NOT NULL, + `Cliente` tinyint NOT NULL, + `Comercial` tinyint NOT NULL, + `Jefe` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `v_ventas_contables` +-- + +DROP TABLE IF EXISTS `v_ventas_contables`; +/*!50001 DROP VIEW IF EXISTS `v_ventas_contables`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v_ventas_contables` ( + `year` tinyint NOT NULL, + `month` tinyint NOT NULL, + `importe` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `variablesKK` +-- + +DROP TABLE IF EXISTS `variablesKK`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `variablesKK` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `variable` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `value` double DEFAULT NULL, + `date` datetime DEFAULT NULL, + `text` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'bi' +-- + +-- +-- Dumping routines for database 'bi' +-- +/*!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 */ ; @@ -57344,33 +58944,24 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = '' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `userHasRoleId`(vRoleId INT) RETURNS tinyint(1) - DETERMINISTIC +CREATE DEFINER=`root`@`%` FUNCTION `nz`(dblCANTIDAD DOUBLE) RETURNS double BEGIN -/** - * Comprueba si el usuario actual tiene asociado un rol. - * - * @param vRoleId Identificador del rol a comprobar - * @return %TRUE si tiene el rol, %FALSE en caso contrario - */ - DECLARE vHasRole BOOL DEFAULT FALSE; - SELECT COUNT(*) > 0 INTO vHasRole - FROM userRole - WHERE id = vRoleId; +DECLARE dblRESULT DOUBLE; + +SET dblRESULT = IFNULL(dblCANTIDAD,0); + +RETURN dblRESULT; - RETURN vHasRole; 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `privSync` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -57380,680 +58971,318 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `privSync`() -proc: BEGIN -/** - * Sincroniza los permisos de los usuarios 'rol' de MySQL - * en base a la jerarquía de roles. Los usuarios rol resultantes - * de la mezcla de permisos serán nombrados singuiendo el patrón - * z-[nombre_rol]. - * - * Para que el procedimiento funcione debe de existir un usuario - * any@% que se usara como plantilla base. - * - * ¡Atención! Este procedimiento solo debe ser llamado cuando se - * modifiquen los privilegios de MySQL. Si se modifica la jerarquía - * de roles, se debe llamar al procedimiento roleSync() que llama a - * este internamente. - */ - DECLARE vTplUser VARCHAR(255) DEFAULT 'any'; - DECLARE vHost VARCHAR(255) DEFAULT '%'; - DECLARE vPrefix VARCHAR(2) DEFAULT 'z-'; - - DECLARE vTplExists BOOL; - DECLARE vTplHost VARCHAR(255); - DECLARE vPrefixedLike VARCHAR(255); - - -- Comprueba que el usuario plantilla existe - - SELECT COUNT(*) > 0, `Host` - INTO vTplExists, vTplHost - FROM mysql.user - WHERE `User` = vTplUser - LIMIT 1; - - IF NOT vTplExists THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'TEMPLATE_USER_NOT_EXISTS'; - END IF; - - -- Borra todos los privilegios calculados - - SET vPrefixedLike = CONCAT(vPrefix, '%'); - - DELETE FROM mysql.user - WHERE `User` LIKE vPrefixedLike; - - DELETE FROM mysql.db - WHERE `User` LIKE vPrefixedLike; - - DELETE FROM mysql.tables_priv - WHERE `User` LIKE vPrefixedLike; - - DELETE FROM mysql.columns_priv - WHERE `User` LIKE vPrefixedLike; - - DELETE FROM mysql.procs_priv - WHERE `User` LIKE vPrefixedLike; - - DELETE FROM mysql.proxies_priv - WHERE `Proxied_user` LIKE vPrefixedLike; - - -- Tablas temporales - - DROP TEMPORARY TABLE IF EXISTS tRole; - CREATE TEMPORARY TABLE tRole - ENGINE = MEMORY - SELECT - `name` role, - CONCAT(vPrefix, `name`) prefixedRole - FROM role - WHERE hasLogin; - - DROP TEMPORARY TABLE IF EXISTS tRoleInherit; - CREATE TEMPORARY TABLE tRoleInherit - (INDEX (inheritsFrom)) - ENGINE = MEMORY - SELECT - CONCAT(vPrefix, r.`name`) prefixedRole, - ri.`name` inheritsFrom - FROM role r - JOIN roleRole rr ON rr.role = r.id - JOIN role ri ON ri.id = rr.inheritsFrom; - - -- Vueve a crear el usuario - - INSERT INTO mysql.user ( - `User`, - `Host`, - `Password`, - `ssl_type`, - `ssl_cipher`, - `x509_issuer`, - `x509_subject`, - `max_questions`, - `max_updates`, - `max_connections`, - `max_user_connections` - ) - SELECT - r.prefixedRole, - vTplHost, - IF('' != u.`Password`, - u.`Password`, t.`Password`), - IF('' != u.`ssl_type`, - u.`ssl_type`, t.`ssl_type`), - IF('' != u.`ssl_cipher`, - u.`ssl_cipher`, t.`ssl_cipher`), - IF('' != u.`x509_issuer`, - u.`x509_issuer`, t.`x509_issuer`), - IF('' != u.`x509_subject`, - u.`x509_subject`, t.`x509_subject`), - IF(0 != u.`max_questions`, - u.`max_questions`, t.`max_questions`), - IF(0 != u.`max_updates`, - u.`max_updates`, t.`max_updates`), - IF(0 != u.`max_connections`, - u.`max_connections`, t.`max_connections`), - IF(0 != u.`max_user_connections`, - u.`max_user_connections`, t.`max_user_connections`) - FROM tRole r - JOIN mysql.user t - ON t.`User` = vTplUser - AND t.`Host` = vTplHost - LEFT JOIN mysql.user u - ON u.`User` = r.role - AND u.`Host` = vHost; - - INSERT INTO mysql.proxies_priv ( - `User`, - `Host`, - `Proxied_user`, - `Proxied_host`, - `Grantor` - ) - SELECT - '', - vHost, - prefixedRole, - vHost, - CONCAT(prefixedRole, '@', vTplHost) - FROM tRole; - - -- Copia los privilegios globales del usuario - - DROP TEMPORARY TABLE IF EXISTS tUserPriv; - CREATE TEMPORARY TABLE tUserPriv - (INDEX (prefixedRole)) - ENGINE = MEMORY - SELECT - r.prefixedRole, - MAX(u.`Select_priv`) `Select_priv`, - MAX(u.`Insert_priv`) `Insert_priv`, - MAX(u.`Update_priv`) `Update_priv`, - MAX(u.`Delete_priv`) `Delete_priv`, - MAX(u.`Create_priv`) `Create_priv`, - MAX(u.`Drop_priv`) `Drop_priv`, - MAX(u.`Reload_priv`) `Reload_priv`, - MAX(u.`Shutdown_priv`) `Shutdown_priv`, - MAX(u.`Process_priv`) `Process_priv`, - MAX(u.`File_priv`) `File_priv`, - MAX(u.`Grant_priv`) `Grant_priv`, - MAX(u.`References_priv`) `References_priv`, - MAX(u.`Index_priv`) `Index_priv`, - MAX(u.`Alter_priv`) `Alter_priv`, - MAX(u.`Show_db_priv`) `Show_db_priv`, - MAX(u.`Super_priv`) `Super_priv`, - MAX(u.`Create_tmp_table_priv`) `Create_tmp_table_priv`, - MAX(u.`Lock_tables_priv`) `Lock_tables_priv`, - MAX(u.`Execute_priv`) `Execute_priv`, - MAX(u.`Repl_slave_priv`) `Repl_slave_priv`, - MAX(u.`Repl_client_priv`) `Repl_client_priv`, - MAX(u.`Create_view_priv`) `Create_view_priv`, - MAX(u.`Show_view_priv`) `Show_view_priv`, - MAX(u.`Create_routine_priv`) `Create_routine_priv`, - MAX(u.`Alter_routine_priv`) `Alter_routine_priv`, - MAX(u.`Create_user_priv`) `Create_user_priv`, - MAX(u.`Event_priv`) `Event_priv`, - MAX(u.`Trigger_priv`) `Trigger_priv`, - MAX(u.`Create_tablespace_priv`) `Create_tablespace_priv` - FROM tRoleInherit r - JOIN mysql.user u - ON u.`User` = r.inheritsFrom - AND u.`Host`= vHost - GROUP BY r.prefixedRole; - - UPDATE mysql.user u - JOIN tUserPriv t - ON u.`User` = t.prefixedRole - AND u.`Host` = vHost - SET - u.`Select_priv` - = t.`Select_priv`, - u.`Insert_priv` - = t.`Insert_priv`, - u.`Update_priv` - = t.`Update_priv`, - u.`Delete_priv` - = t.`Delete_priv`, - u.`Create_priv` - = t.`Create_priv`, - u.`Drop_priv` - = t.`Drop_priv`, - u.`Reload_priv` - = t.`Reload_priv`, - u.`Shutdown_priv` - = t.`Shutdown_priv`, - u.`Process_priv` - = t.`Process_priv`, - u.`File_priv` - = t.`File_priv`, - u.`Grant_priv` - = t.`Grant_priv`, - u.`References_priv` - = t.`References_priv`, - u.`Index_priv` - = t.`Index_priv`, - u.`Alter_priv` - = t.`Alter_priv`, - u.`Show_db_priv` - = t.`Show_db_priv`, - u.`Super_priv` - = t.`Super_priv`, - u.`Create_tmp_table_priv` - = t.`Create_tmp_table_priv`, - u.`Lock_tables_priv` - = t.`Lock_tables_priv`, - u.`Execute_priv` - = t.`Execute_priv`, - u.`Repl_slave_priv` - = t.`Repl_slave_priv`, - u.`Repl_client_priv` - = t.`Repl_client_priv`, - u.`Create_view_priv` - = t.`Create_view_priv`, - u.`Show_view_priv` - = t.`Show_view_priv`, - u.`Create_routine_priv` - = t.`Create_routine_priv`, - u.`Alter_routine_priv` - = t.`Alter_routine_priv`, - u.`Create_user_priv` - = t.`Create_user_priv`, - u.`Event_priv` - = t.`Event_priv`, - u.`Trigger_priv` - = t.`Trigger_priv`, - u.`Create_tablespace_priv` - = t.`Create_tablespace_priv`; - - DROP TEMPORARY TABLE tUserPriv; - - -- Copia los privilegios a nivel de esquema - - INSERT INTO mysql.db ( - `User`, - `Host`, - `Db`, - `Select_priv`, - `Insert_priv`, - `Update_priv`, - `Delete_priv`, - `Create_priv`, - `Drop_priv`, - `Grant_priv`, - `References_priv`, - `Index_priv`, - `Alter_priv`, - `Create_tmp_table_priv`, - `Lock_tables_priv`, - `Create_view_priv`, - `Show_view_priv`, - `Create_routine_priv`, - `Alter_routine_priv`, - `Execute_priv`, - `Event_priv`, - `Trigger_priv` - ) - SELECT - r.prefixedRole, - vTplHost, - t.`Db`, - MAX(t.`Select_priv`), - MAX(t.`Insert_priv`), - MAX(t.`Update_priv`), - MAX(t.`Delete_priv`), - MAX(t.`Create_priv`), - MAX(t.`Drop_priv`), - MAX(t.`Grant_priv`), - MAX(t.`References_priv`), - MAX(t.`Index_priv`), - MAX(t.`Alter_priv`), - MAX(t.`Create_tmp_table_priv`), - MAX(t.`Lock_tables_priv`), - MAX(t.`Create_view_priv`), - MAX(t.`Show_view_priv`), - MAX(t.`Create_routine_priv`), - MAX(t.`Alter_routine_priv`), - MAX(t.`Execute_priv`), - MAX(t.`Event_priv`), - MAX(t.`Trigger_priv`) - FROM tRoleInherit r - JOIN mysql.db t - ON t.`User` = r.inheritsFrom - AND t.`Host`= vHost - GROUP BY r.prefixedRole, t.`Db`; - - -- Copia los privilegios a nivel de tabla - - INSERT INTO mysql.tables_priv ( - `User`, - `Host`, - `Db`, - `Table_name`, - `Grantor`, - `Timestamp`, - `Table_priv`, - `Column_priv` - ) - SELECT - r.prefixedRole, - vTplHost, - t.`Db`, - t.`Table_name`, - t.`Grantor`, - MAX(t.`Timestamp`), - GROUP_CONCAT(CONCAT(t.`Table_priv`, ',')), - GROUP_CONCAT(CONCAT(t.`Column_priv`, ',')) - FROM tRoleInherit r - JOIN mysql.tables_priv t - ON t.`User` = r.inheritsFrom - AND t.`Host`= vHost - GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`; - - -- Copia los privilegios a nivel de columna - - INSERT INTO mysql.columns_priv ( - `User`, - `Host`, - `Db`, - `Table_name`, - `Column_name`, - `Timestamp`, - `Column_priv` - ) - SELECT - r.prefixedRole, - vTplHost, - t.`Db`, - t.`Table_name`, - t.`Column_name`, - MAX(t.`Timestamp`), - GROUP_CONCAT(CONCAT(t.`Column_priv`, ',')) - FROM tRoleInherit r - JOIN mysql.columns_priv t - ON t.`User` = r.inheritsFrom - AND t.`Host`= vHost - GROUP BY r.prefixedRole, t.`Db`, t.`Table_name`, t.`Column_name`; - - -- Copia los privilegios de los procedimientos - - INSERT IGNORE INTO mysql.procs_priv ( - `User`, - `Host`, - `Db`, - `Routine_name`, - `Routine_type`, - `Grantor`, - `Timestamp`, - `Proc_priv` - ) - SELECT - r.prefixedRole, - vTplHost, - t.`Db`, - t.`Routine_name`, - t.`Routine_type`, - t.`Grantor`, - t.`Timestamp`, - t.`Proc_priv` - FROM tRoleInherit r - JOIN mysql.procs_priv t - ON t.`User` = r.inheritsFrom - AND t.`Host`= vHost; - - -- Libera memoria - - DROP TEMPORARY TABLE - tRole, - tRoleInherit; - - FLUSH PRIVILEGES; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `roleGetDescendents` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `roleGetDescendents`(vRole INT) +CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_evolution_add`() BEGIN -/** - * Obtiene los identificadores de todos los subroles - * implementados por un rol (Incluido el mismo). - * - * @param vRole Identificador del rol - * @table tmp.role Subroles implementados por el rol - */ - DECLARE vIsRoot BOOL; + DECLARE vPreviousPeriod INT; + DECLARE vCurrentPeriod INT; + DECLARE vLastPeriod INT; + DECLARE vMinPeriod INT DEFAULT 201400; + DECLARE vMaxPeriod INT DEFAULT vn2008.vnperiod(CURDATE()); - DROP TEMPORARY TABLE IF EXISTS - tmp.role, parents, childs; + DECLARE vYear INT; + DECLARE vWeek INT; - CREATE TEMPORARY TABLE tmp.role - (UNIQUE (id)) - ENGINE = MEMORY - SELECT vRole AS id; + -- Almacen - CREATE TEMPORARY TABLE parents - ENGINE = MEMORY - SELECT vRole AS id; + SET vCurrentPeriod = IFNULL(vLastPeriod, vMinPeriod); - CREATE TEMPORARY TABLE childs - LIKE parents; + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT MAX(Periodo) INTO vPreviousPeriod + FROM bi.analisis_ventas_almacen_evolution + WHERE Periodo < vMaxPeriod; - REPEAT - DELETE FROM childs; - INSERT INTO childs - SELECT DISTINCT r.inheritsFrom id - FROM parents p - JOIN roleInherit r ON r.role = p.id - LEFT JOIN tmp.role t ON t.id = r.inheritsFrom - WHERE t.id IS NULL; + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; - DELETE FROM parents; - INSERT INTO parents - SELECT * FROM childs; + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); - INSERT INTO tmp.role - SELECT * FROM childs; + DELETE FROM bi.analisis_ventas_almacen_evolution + WHERE Periodo = vCurrentPeriod; - UNTIL ROW_COUNT() <= 0 - END REPEAT; - - -- If it is root all the roles are added - - SELECT COUNT(*) > 0 INTO vIsRoot - FROM tmp.role - WHERE id = 0; - - IF vIsRoot THEN - INSERT IGNORE INTO tmp.role (id) - SELECT id FROM role; - END IF; - - -- Cleaning - - DROP TEMPORARY TABLE - parents, childs; -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `roleSync` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `roleSync`() -BEGIN -/** - * Sincroniza la tabla @roleRole con la jerarquía de roles - * actual. Este procedimiento debe ser llamado cada vez que - * se modifique la tabla @roleInherit para que los cambios - * realizados sobre esta sean efectivos. - */ - DECLARE vRoleId INT; - DECLARE vDone BOOL; - - DECLARE cur CURSOR FOR - SELECT id FROM role; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - TRUNCATE TABLE roleRole; - - OPEN cur; - - l: LOOP - SET vDone = FALSE; - FETCH cur INTO vRoleId; - - IF vDone THEN - LEAVE l; - END IF; - - CALL roleGetDescendents (vRoleId); - - INSERT INTO roleRole (role, inheritsFrom) - SELECT vRoleId, id FROM tmp.role; - - DROP TEMPORARY TABLE tmp.role; - END LOOP; - - CLOSE cur; - - CALL privSync(); -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userChangePassword` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userChangePassword`(vOldPassword VARCHAR(255), vPassword VARCHAR(255)) -BEGIN -/** - * Cambia la contraseña del usuario actual,si el usuario se - * encuntra en modo restauración se ignorará la contraseña - * actual. - * - * @param vOldPassword Contraseña actual - * @param vPassword Nueva contraseña - */ - DECLARE vPasswordOk BOOL; - - SELECT `password` = MD5(vOldPassword) OR recoverPass - INTO vPasswordOk - FROM user WHERE id = account.userGetId(); - - IF NOT vPasswordOk THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Invalid password'; - END IF; - - CALL userSetPassword (userGetName(), vPassword); -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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userCheckName` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userCheckName`(vUserName VARCHAR(255)) -BEGIN -/** - * Comprueba que el nombre de usuario reune los requisitos - * de sintaxis necesarios, en caso contrario lanza una - * excepción. - * El nombre de usuario solo debe contener letras minúsculas - * o, a partir del segundo carácter, números o subguiones. - **/ - IF vUserName NOT REGEXP '^[a-z0-9_]*$' THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'INVALID_USER_NAME'; - 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userCheckPassword` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userCheckPassword`(vPassword VARCHAR(255)) -BEGIN -/** - * Comprueba si la contraseña cumple los requisitos de seguridad - * establecidos. Lanza una excepción si no se cumplen. - * - * @param vPassword Contraseña a comprobar - */ - DECLARE vChr CHAR(1); - DECLARE vPasswordOk TINYINT; - DECLARE vI TINYINT DEFAULT 1; - DECLARE vNAlpha TINYINT DEFAULT 0; - DECLARE vNUpper TINYINT DEFAULT 0; - DECLARE vNDigits TINYINT DEFAULT 0; - DECLARE vNPunct TINYINT DEFAULT 0; - - WHILE vI <= CHAR_LENGTH(vPassword) - DO - SET vChr = SUBSTRING(vPassword, vI, 1); - - IF vChr REGEXP '[[:alpha:]]' - THEN - SET vNAlpha = vNAlpha+1; - - IF vChr REGEXP '[A-Z]' - THEN - SET vNUpper = vNUpper+1; - END IF; - ELSEIF vChr REGEXP '[[:digit:]]' - THEN - SET vNDigits = vNDigits+1; - ELSEIF vChr REGEXP '[[:punct:]]' - THEN - SET vNPunct = vNPunct+1; - END IF; - - SET vI = vI+1; + REPLACE bi.analisis_ventas_almacen_evolution(Almacen, Ventas, Semana,Año, Periodo) + SELECT Almacen, sum(Ventas) AS Ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT almacen, sum(Importe) AS Ventas + FROM bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY almacen + UNION ALL + SELECT almacen, - sum(Importe) AS Ventas + FROM bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY almacen + UNION ALL + SELECT Almacen, Ventas + FROM bi.analisis_ventas_almacen_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY Almacen; END WHILE; - SELECT - CHAR_LENGTH(vPassword) >= length - AND vNAlpha >= nAlpha - AND vNUpper >= nUpper - AND vNDigits >= nDigits - AND vNPunct >= nPunct - INTO vPasswordOk - FROM userPassword LIMIT 1; + -- Reino - IF NOT vPasswordOk THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Password does not meet requirements'; - END IF; + SET vCurrentPeriod = vMinPeriod; + + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT MAX(periodo) INTO vPreviousPeriod + FROM bi.analisis_ventas_reino_evolution + WHERE periodo < vMaxPeriod; + + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; + + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); + + DELETE FROM bi.analisis_ventas_reino_evolution + WHERE Periodo = vCurrentPeriod; + + REPLACE bi.analisis_ventas_reino_evolution(reino, ventas, semana,año, periodo) + SELECT reino, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT Reino, sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY Reino + UNION ALL + SELECT Reino, - sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY Reino + UNION ALL + SELECT reino, ventas + FROM bi.analisis_ventas_reino_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY reino; + END WHILE; + + -- Familia + + SET vCurrentPeriod = vMinPeriod; + + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT MAX(periodo) INTO vPreviousPeriod + FROM bi.analisis_ventas_familia_evolution + WHERE periodo < vMaxPeriod; + + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; + + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); + + DELETE FROM bi.analisis_ventas_familia_evolution + WHERE Periodo = vCurrentPeriod; + + REPLACE bi.analisis_ventas_familia_evolution(familia, ventas, semana,año, periodo) + SELECT Familia, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT Familia, sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY familia + UNION ALL + SELECT Familia, - sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY familia + UNION ALL + SELECT familia, ventas + FROM bi.analisis_ventas_familia_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY Familia; + END WHILE; + + -- Comprador + -- FIXME: Bucle infinito porque la tabla está vacía +/* + SET vCurrentPeriod = vMinPeriod; + + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT IFNULL(MAX(periodo),vMinPeriod) INTO vPreviousPeriod + FROM bi.analisis_ventas_comprador_evolution + WHERE periodo < vMaxPeriod; + + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; + + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); + + DELETE FROM bi.analisis_ventas_comprador_evolution + WHERE Periodo = vCurrentPeriod; + + REPLACE bi.analisis_ventas_comprador_evolution(comprador, ventas, semana,año, periodo) + SELECT Comprador, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT Comprador, sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY Comprador + UNION ALL + SELECT Comprador, - sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY Comprador + UNION ALL + SELECT comprador, IFNULL(ventas,0) + FROM bi.analisis_ventas_comprador_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY Comprador; + END WHILE; +*/ + -- Provincia + + SET vCurrentPeriod = vMinPeriod; + + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT MAX(periodo) INTO vPreviousPeriod + FROM bi.analisis_ventas_provincia_evolution + WHERE periodo < vMaxPeriod; + + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; + + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); + + DELETE FROM bi.analisis_ventas_provincia_evolution + WHERE Periodo = vCurrentPeriod; + + REPLACE bi.analisis_ventas_provincia_evolution(provincia, ventas, semana,año, periodo) + SELECT Provincia, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT Provincia, sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY Provincia + UNION ALL + SELECT Provincia, - sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY Provincia + UNION ALL + SELECT provincia, ventas + FROM bi.analisis_ventas_provincia_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY Provincia; + END WHILE; + + -- Vista + + SET vCurrentPeriod = vMinPeriod; + + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT MAX(periodo) INTO vPreviousPeriod + FROM bi.analisis_ventas_vista_evolution + WHERE periodo < vMaxPeriod; + + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; + + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); + + DELETE FROM bi.analisis_ventas_vista_evolution + WHERE Periodo = vCurrentPeriod; + + REPLACE bi.analisis_ventas_vista_evolution(vista, ventas, semana,año, periodo) + SELECT vista, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT Vista, sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY Vista + UNION ALL + SELECT Vista, - sum(Importe) AS ventas + FROM bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY Vista + UNION ALL + SELECT vista, ventas + FROM bi.analisis_ventas_vista_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY Vista; + END WHILE; + + -- Vendedor + + SET vCurrentPeriod = vMinPeriod; + + WHILE vCurrentPeriod < vMaxPeriod + DO + SELECT MAX(periodo) INTO vPreviousPeriod + FROM bi.analisis_ventas_vendedor_evolution + WHERE periodo < vMaxPeriod; + + SELECT MIN(period) INTO vCurrentPeriod + FROM vn2008.time + WHERE period > vPreviousPeriod; + + SET vYear = FLOOR(vCurrentPeriod / 100); + SET vWeek = vCurrentPeriod - (vYear * 100); + + DELETE FROM bi.analisis_ventas_vendedor_evolution + WHERE Periodo = vCurrentPeriod; + + REPLACE bi.analisis_ventas_vendedor_evolution(vendedor, ventas, semana,año, periodo) + SELECT Comercial AS vendedor, sum(ventas) AS ventas, vWeek, vYear, vCurrentPeriod + FROM ( + SELECT Comercial, sum(Importe) AS ventas + from bi.analisis_ventas + WHERE vYear = Año + AND vWeek = Semana + GROUP BY Comercial + UNION ALL + SELECT Comercial, - sum(Importe) AS ventas + from bi.analisis_ventas + WHERE vYear - 1 = Año + AND vWeek = Semana + GROUP BY Comercial + UNION ALL + SELECT vendedor, ventas + FROM bi.analisis_ventas_vendedor_evolution + WHERE Periodo = vPreviousPeriod + ) sub + GROUP BY vendedor; + END WHILE; 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userLogin` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `analisis_ventas_simple` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -58063,28 +59292,520 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userLogin`(vUserName VARCHAR(255), vPassword VARCHAR(255)) +CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_simple`() BEGIN -/** - * Incicia sesión utilizando las credenciales del usuario. - * - * @param vUserName El nombre de usuario - * @param vPassword La contraseña del usuario - */ - DECLARE vUserId INT DEFAULT NULL; - SELECT id INTO vUserId FROM user - WHERE name = vUserName - AND password = MD5(vPassword) - AND active; +TRUNCATE bi.analisis_grafico_simple; - IF vUserId IS NOT NULL +INSERT INTO bi.analisis_grafico_simple SELECT * FROM bi.analisis_grafico_ventas; + +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 DROP PROCEDURE IF EXISTS `analisis_ventas_update` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `analisis_ventas_update`() +BEGIN + + DECLARE vLastMonth DATE; + + SET vLastMonth = util.firstDayOfMonth(TIMESTAMPADD(MONTH, -1, CURDATE())); + + DELETE FROM bi.analisis_ventas + WHERE Año > YEAR(vLastMonth) + OR (Año = YEAR(vLastMonth) AND Mes >= MONTH(vLastMonth)); + + INSERT INTO bi.analisis_ventas + + SELECT + `tp`.`Tipo` AS `Familia`, + `r`.`reino` AS `Reino`, + `tr`.`CodigoTrabajador` AS `Comercial`, + `tr2`.`CodigoTrabajador` AS `Comprador`, + `p`.`name` AS `Provincia`, + `w`.`name` AS `almacen`, + `time`.`year` AS `Año`, + `time`.`month` AS `Mes`, + `time`.`week` AS `Semana`, + `v`.`vista` AS `Vista`, + `bt`.`importe` AS `Importe` + FROM + (((((((((`bs`.`ventas` `bt` + LEFT JOIN `vn2008`.`Tipos` `tp` ON ((`tp`.`tipo_id` = `bt`.`tipo_id`))) + LEFT JOIN `vn2008`.`reinos` `r` ON ((`r`.`id` = `tp`.`reino_id`))) + LEFT JOIN `vn2008`.`Clientes` c on c.Id_Cliente = bt.Id_Cliente + LEFT JOIN `vn2008`.`Trabajadores` `tr` ON ((`tr`.`Id_Trabajador` = `c`.`Id_Trabajador`))) + LEFT JOIN `vn2008`.`Trabajadores` `tr2` ON ((`tr2`.`Id_Trabajador` = `tp`.`Id_Trabajador`))) + JOIN vn2008.time on time.date = bt.fecha + JOIN vn2008.Movimientos m on m.Id_Movimiento = bt.Id_Movimiento + LEFT JOIN `vn2008`.`Tickets` `t` ON ((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) + JOIN vn2008.Agencias a on a.Id_Agencia = t.Id_Agencia + LEFT JOIN `vn2008`.`Vistas` `v` ON ((`v`.`vista_id` = `a`.`Vista`))) + LEFT JOIN `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`))) + WHERE bt.fecha >= vLastMonth AND r.mercancia; + +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 DROP PROCEDURE IF EXISTS `call_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `call_add`() +BEGIN + +DECLARE datSTART DATETIME DEFAULT '2012-03-01'/*CURDATE()*/; +-- control +INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.call_add'); + +-- Seleccionamos la ultima fecha introducida +SELECT MAX(Fecha) INTO datSTART FROM `call`; + + +-- Borramos todas las entradas del dia datSTART por si hubiese registros nuevos +DELETE FROM `call` WHERE Fecha = datSTART; + +INSERT INTO bi.`call`(CodTrabajadorCartera,CodTrabajadorTelefono,dur_in,dur_out,Fecha,`year`,`month`,`week`,`hour`,phone) +SELECT vn2008.Averiguar_ComercialCliente(pb.Id_Cliente,Fecha) CodTrabajadorCartera,ll.CodigoTrabajador, dur_in, + dur_out, ll.Fecha,YEAR(ll.Fecha) `year`, MONTH(ll.Fecha) `month`,WEEK(ll.Fecha,7) `week`, Hora,phone +FROM +( +SELECT Id_Trabajador,CodigoTrabajador, IFNULL(billsec,0) dur_in, 0 dur_out, 1 as Recibidas, NULL as Emitidas, calldate as Fecha, + hour(calldate) as Hora,src as phone +FROM vn2008.Trabajadores T +INNER JOIN vn2008.cdr C ON C.dstchannel LIKE CONCAT('%', T.extension, '%') +WHERE calldate >= datSTART AND LENGTH(C.src) >=9 AND disposition = 'ANSWERED' AND duration +UNION ALL +SELECT Id_Trabajador,CodigoTrabajador,0 dur_in, IFNULL(billsec,0) dur_out, NULL as Recibidas, 1 as Emitidas, date(calldate), hour(calldate),dst +FROM vn2008.Trabajadores T +INNER JOIN vn2008.cdr C ON C.src = T.extension +WHERE calldate >= datSTART AND LENGTH(C.dst) >=9 AND disposition = 'ANSWERED' AND duration +) ll +INNER JOIN vn2008.Permisos USING(Id_Trabajador) +LEFT JOIN vn2008.v_phonebook pb ON pb.Telefono = ll.phone +WHERE Id_Grupo = 6; + +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 DROP PROCEDURE IF EXISTS `claim_ratio_routine` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `claim_ratio_routine`() +BEGIN + +DECLARE vMonthToRefund INT DEFAULT 4; + +-- control +INSERT INTO vn2008.daily_task_log(consulta) + VALUES('bi.claim_ratio_routine START'); + +/* +* PAK 2015-11-20 +* Se trata de añadir a la tabla Greuges todos los +* cargos que luego vamos a utilizar para calcular el recobro +*/ + +-- descuentos comerciales COD 11 + +INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, Importe, Id_Ticket) + SELECT Fecha, Id_Cliente, Concat('COD11 : ',Concepte), - round(Cantidad * + Preu * (100 - Descuento) / 100 ,2) AS Importe, t.Id_Ticket + FROM vn2008.Tickets t + JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket + WHERE Id_Article = 11 + AND Concepte NOT LIKE '$%' + AND Fecha > '2014-01-01' + HAVING nz(Importe) <> 0; + +DELETE mc.* + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + WHERE m.Id_Article = 11 + AND m.Concepte NOT LIKE '$%' + AND t.Fecha > '2017-01-01'; + +INSERT INTO vn2008.Movimientos_componentes(Id_Movimiento, Id_Componente, Valor) + SELECT m.Id_Movimiento, 34, round(m.Preu * (100 - m.Descuento)/100,4) + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + WHERE m.Id_Article = 11 + AND m.Concepte NOT LIKE '$%' + AND t.Fecha > '2017-01-01'; + +UPDATE vn2008.Movimientos m + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + SET Concepte = CONCAT('$ ',Concepte) + WHERE Id_Article = 11 + AND Concepte NOT LIKE '$%' + AND Fecha > '2014-01-01'; + +-- Reclamaciones demasiado sensibles + +INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, + Importe, Greuges_type_id,Id_Ticket) + SELECT cm.Fecha + , cm.Id_Cliente + , concat('Claim ',cm.id,' : ', m.Concepte) + ,round( -1 * ((sensib -1)/4) * Cantidad * + Preu * (100 - Descuento) / 100, 2) AS Reclamaciones + , 4 + , m.Id_Ticket + FROM vn2008.Movimientos m + JOIN vn2008.cl_act ca USING(Id_Movimiento) + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + WHERE ca.cl_sol_id NOT IN (1,5) + AND ca.greuge = 0 + AND cm.cl_est_id = 3; + + -- Reclamaciones que pasan a Maná + +INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, + Importe , Greuges_type_id,Id_Ticket) + SELECT cm.Fecha + , cm.Id_Cliente + , concat('Claim_mana ',cm.id,' : ', m.Concepte) + ,round( ((sensib -1)/4) * Cantidad * Preu * (100 - Descuento) / 100, 2) + AS Reclamaciones + ,3 + ,m.Id_Ticket + FROM vn2008.Movimientos m + JOIN vn2008.cl_act ca USING(Id_Movimiento) + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + WHERE ca.cl_sol_id NOT IN (1,5) + AND ca.greuge = 0 + AND cm.cl_est_id = 3 + AND cm.mana; + + -- Marcamos para no repetir +UPDATE vn2008.cl_act ca + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + SET greuge = 1 + WHERE ca.cl_sol_id NOT IN (1,5) + AND ca.greuge = 0 + AND cm.cl_est_id = 3; + + + +-- Recobros + +DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; +CREATE TEMPORARY TABLE tmp.ticket_list +(PRIMARY KEY (Id_Ticket)) +SELECT DISTINCT t.Id_Ticket + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN vn2008.Tickets_state ts ON ts.Id_Ticket = t.Id_Ticket + JOIN vncontrol.inter i ON i.inter_id = ts.inter_id + JOIN vn2008.state s ON s.id = i.state_id + WHERE mc.Id_Componente = 17 + AND mc.greuge = 0 + AND t.Fecha >= '2016-10-01' + AND t.Fecha < CURDATE() + AND t.warehouse_id <> 41 + 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; + +INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, + Greuges_type_id, Id_Ticket) + SELECT Id_Cliente + ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) + AS dif + ,date(t.Fecha) + , 2 + ,tt.Id_Ticket + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.Id_Ticket + JOIN vn2008.Movimientos_componentes mc + ON mc.Id_Movimiento = m.Id_Movimiento AND mc.Id_Componente = 17 + GROUP BY t.Id_Ticket + HAVING ABS(dif) > 1; + +UPDATE vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + JOIN tmp.ticket_list tt ON tt.Id_Ticket = m.Id_Ticket + SET greuge = 1 + WHERE Id_Componente = 17; + +/* +* Recalculamos la ratio de las reclamaciones, que luego +* se va a utilizar en el recobro +*/ + +DELETE FROM bi.claims_ratio; + +REPLACE bi.claims_ratio(Id_Cliente, Consumo, Reclamaciones, Ratio, recobro) + SELECT fm.Id_Cliente, 12 * fm.Consumo, Reclamaciones, + round(Reclamaciones / (12*fm.Consumo),4) AS Ratio, 0 + FROM bi.facturacion_media_anual fm + LEFT JOIN( + SELECT cm.Id_Cliente, round(sum(-1 * ((sensib -1)/4) * + Cantidad * Preu * (100 - Descuento) / 100)) + AS Reclamaciones + FROM vn2008.Movimientos m + JOIN vn2008.cl_act ca + ON ca.Id_Movimiento = m.Id_Movimiento + JOIN vn2008.cl_main cm ON cm.id = ca.cl_main_id + WHERE ca.cl_sol_id NOT IN (1,5) + AND cm.cl_est_id = 3 + AND cm.Fecha >= TIMESTAMPADD(YEAR, -1, CURDATE()) + GROUP BY cm.Id_Cliente + ) claims ON claims.Id_Cliente = fm.Id_Cliente; + + +-- 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 <= CURDATE() + GROUP BY Id_Cliente + ) g ON g.Id_Cliente = cr.Id_Cliente + SET recobro = GREATEST(0,round(nz(Greuge) / + (nz(Consumo) * vMonthToRefund / 12 ) ,3)); + +-- Protección neonatos +/* +UPDATE bi.claims_ratio cr + JOIN vn2008.Clientes c ON c.Id_Cliente = cr.Id_Cliente + SET recobro = 0, Ratio = 0 + WHERE c.created > TIMESTAMPADD(MONTH,-1,CURDATE()); + */ +UPDATE bi.claims_ratio cr + JOIN vn.firstTicketShipped fts ON fts.clientFk = cr.Id_Cliente + SET recobro = 0, Ratio = 0 + WHERE fts.shipped > TIMESTAMPADD(MONTH,-1,CURDATE()); + +-- control +INSERT INTO vn2008.daily_task_log(consulta) + VALUES('bi.claim_ratio_routine END'); +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 DROP PROCEDURE IF EXISTS `clean` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `clean`() +BEGIN +DECLARE vDateShort DATETIME; +DECLARE vDateLong DATETIME; +DECLARE vOneYearAgo DATETIME; + +SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); +SET vDateLong = TIMESTAMPADD(MONTH, -18,CURDATE()); +SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,CURDATE()); + +INSERT INTO bi.dailyTaskLog(state) VALUES('clean START'); + +DELETE FROM bi.comparativa_clientes WHERE Fecha < vDateLong; + +DELETE + FROM bi.Greuge_Evolution + WHERE (Fecha < vDateShort AND weekday(Fecha) != 1) + OR Fecha < vOneYearAgo; + +INSERT INTO bi.dailyTaskLog(state) VALUES('clean END'); +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 DROP PROCEDURE IF EXISTS `clean_launcher` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `clean_launcher`() +BEGIN + + call vn2008.clean(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 DROP PROCEDURE IF EXISTS `comparativa_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add`() +BEGIN + DECLARE lastCOMP INT; # Se trata de una variable para almacenar el ultimo valor del Periodo + + SELECT MAX(Periodo) INTO lastCOMP FROM vn2008.Comparativa; + -- Fijaremos las ventas con más de un mes de antiguedad en la tabla Comparativa + + IF lastCOMP < vn2008.vnperiod(CURDATE())- 3 AND vn2008.vnweek(CURDATE()) > 3 THEN + + REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) + SELECT tm.period as Periodo, m.Id_Article, t.warehouse_id, sum(m.Cantidad), sum(v.importe) + FROM bs.ventas v + JOIN vn2008.time tm ON tm.date = v.fecha + JOIN vn2008.Movimientos m ON m.Id_Movimiento = v.Id_Movimiento + JOIN vn2008.Articles a ON a.Id_Article = m.Id_Article + JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id + JOIN vn2008.reinos r ON r.id = tp.reino_id + JOIN vn2008.Tickets t ON t.Id_Ticket = m.Id_Ticket + WHERE tm.period BETWEEN lastCOMP AND vn2008.vnperiod(CURDATE())- 3 + AND t.Id_Cliente NOT IN(400,200) + AND r.display <> 0 + AND t.warehouse_id NOT IN (0,13) + GROUP BY Id_Article, Periodo, warehouse_id; + + +/* + REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) + SELECT vn2008.vnperiod(T.Fecha) AS Periodo + , Id_Article + , warehouse_id + , SUM(Cantidad) AS Total + , SUM(Cantidad * Preu * (100 - Descuento) / 100) precio + FROM vn2008.Movimientos M + JOIN vn2008.Tickets T USING (Id_Ticket) + JOIN vn2008.Articles A USING (Id_Article) + LEFT JOIN vn2008.Tipos ti ON ti.tipo_id = A.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = ti.reino_id + WHERE T.Fecha BETWEEN TIMESTAMPADD(DAY,-60,CURDATE()) AND TIMESTAMPADD(DAY,-30,CURDATE()) + AND T.Id_Cliente NOT IN(400,200) + AND display <> 0 AND warehouse_id NOT IN (0,13) + GROUP BY Id_Article, Periodo, warehouse_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 DROP PROCEDURE IF EXISTS `comparativa_add_manual` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `comparativa_add_manual`(IN dat_START DATE, IN dat_END DATE) +BEGIN + + DECLARE datINI DATETIME; + DECLARE datFIN DATETIME; + + -- Seleccionamos la fecha minima/maxima del periodo que vamos a consultar + SELECT MIN(`date`) INTO datINI FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_START); + SELECT TIMESTAMP(MAX(`date`),'23:59:59') INTO datFIN FROM vn2008.`time` WHERE period = vn2008.vnperiod(dat_END); + + DELETE FROM vn2008.Comparativa WHERE Periodo BETWEEN vn2008.vnperiod(dat_START) and vn2008.vnperiod(dat_END); + + REPLACE vn2008.Comparativa(Periodo, Id_Article, warehouse_id, Cantidad,price) + SELECT tm.period AS Periodo + , M.Id_Article + , t.warehouse_id + , SUM(Cantidad) AS Total + , sum(v.importe) AS precio + FROM vn2008.Movimientos M + JOIN vn2008.Tickets t on t.Id_Ticket = M.Id_Ticket + JOIN bs.ventas v on v.Id_Movimiento = M.Id_Movimiento + JOIN vn2008.time tm on tm.date = v.fecha + JOIN vn2008.Tipos tp on v.tipo_id = tp.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + WHERE v.fecha BETWEEN datINI and datFIN + AND r.display <> 0 AND t.warehouse_id NOT IN (0,13) + GROUP BY Id_Article, Periodo, t.warehouse_id; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `customer_risk_update` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `customer_risk_update`(v_customer INT, v_company INT, v_amount DECIMAL(10,2)) +BEGIN + IF v_amount IS NOT NULL THEN - REPLACE INTO userSession (connectionId, user, userName) - VALUES (CONNECTION_ID(), vUserId, vUserName); - ELSE - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'INVALID_CREDENTIALS'; + INSERT INTO bi.customer_risk + SET + customer_id = v_customer, + company_id = v_company, + amount = v_amount + ON DUPLICATE KEY UPDATE + amount = amount + VALUES(amount); END IF; END ;; DELIMITER ; @@ -58092,9 +59813,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userLoginWithName` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `defaultersFromDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -58104,32 +59823,34 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userLoginWithName`(vUserName VARCHAR(255)) +CREATE DEFINER=`root`@`%` PROCEDURE `defaultersFromDate`(IN vDate DATE) BEGIN -/** - * Incicia sesión utilizando únicamente el nombre del - * usuario. Este procedimiento esta pensado para el uso - * de los desarrolladores por lo que los usuarios normales - * no deberían tener permisos de ejecución sobre él. - * - * @param vUserName El nombre de usuario - */ - DECLARE vUserId INT DEFAULT NULL; - SELECT id INTO vUserId FROM user - WHERE name = vUserName; - - REPLACE INTO userSession (connectionId, user, userName) - VALUES (CONNECTION_ID(), vUserId, vUserName); +SELECT t1.*, c.Cliente, w.workerCode, c.pay_met_id,c.Vencimiento +FROM ( +-- Filtramos aquellos clientes cuyo saldo se ha incrementado de ayer a hoy + select * from( + select today.client, today.amount todayAmount, yesterday.amount yesterdayAmount, round(yesterday.amount - today.amount,2) as difference, defaulterSince + from + (select client, amount, defaulterSince + from defaulters + where date = vDate and hasChanged) today + join + (select client, amount + from defaulters + where date = TIMESTAMPADD(DAY,-1,vDate)) yesterday using(client) + + having today.amount > 0 and difference <> 0 + ) newDefaulters +)t1 left join vn2008.Clientes c ON t1.client = c.Id_Cliente + left join vn.worker w ON w.id = c.Id_Trabajador; 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userLogout` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `defaulting` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -58139,27 +59860,94 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userLogout`() +CREATE DEFINER=`root`@`%` PROCEDURE `defaulting`(IN vDate DATE) BEGIN -/** - * Cierra la sesión del usuario y limpia registros - * residuales. - */ - DECLARE vCleanTime DATETIME - DEFAULT TIMESTAMPADD(MINUTE, -30, NOW()); + DECLARE vDone BOOLEAN; + DECLARE vClient INT; + DECLARE vAmount INT; + DECLARE vDateInvoice DATE; + DECLARE vAmountInvoice DECIMAL(10,2); + DECLARE vDueDay INT; + DECLARE vGraceDays INT; + DECLARE defaulters CURSOR FOR + SELECT client, amount, Vencimiento, graceDays FROM bi.defaulters d + JOIN vn2008.Clientes c ON c.Id_Cliente = d.client + JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id + WHERE hasChanged AND date = vDate; + + DECLARE invoices CURSOR FOR + SELECT Fecha, importe FROM vn2008.Facturas f + WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + -- Control - DELETE FROM userSession - WHERE connectionId = CONNECTION_ID() - OR creationDate < vCleanTime; + INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); + + DELETE FROM bi.defaulters WHERE date = vDate; + + INSERT INTO bi.defaulters(client, date, amount) + SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount + FROM bi.customerRiskOverdue + GROUP BY customer_id; + + -- marcamos si ha cambiado y heredamos la fecha defaulterSince + UPDATE bi.defaulters d + JOIN ( + SELECT * FROM( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date <= TIMESTAMPADD(DAY,-1, vDate) + ORDER BY date DESC) t GROUP BY client + ) yesterday using(client) + SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), + d.defaulterSince = yesterday.defaulterSince + WHERE d.date = vDate ; + + OPEN defaulters; + defaulters: LOOP + SET vDone = FALSE; + SET vAmount = 0; + FETCH defaulters INTO vClient,vAmount, vDueDay, vGraceDays; + IF vDone THEN + LEAVE defaulters; + END IF; + OPEN invoices; + invoices:LOOP + + FETCH invoices INTO vDateInvoice, vAmountInvoice; + IF vDone THEN + LEAVE invoices; + END IF; + + IF TIMESTAMPADD(DAY, vGraceDays, vn2008.paymentday(vDateInvoice, vDueDay)) <= vDate THEN + SET vAmount = vAmount - vAmountInvoice; + IF vAmount <= 0 THEN + UPDATE defaulters SET defaulterSince = vn2008.paymentday(vDateInvoice, vDueDay) + WHERE client = vClient and date = vDate; + + SET vAmount = 0; + LEAVE invoices; + END IF; + END IF; + END LOOP; + CLOSE invoices; + END LOOP; + CLOSE defaulters; + DELETE FROM bi.defaulting WHERE date = vDate; + + INSERT INTO bi.defaulting(date, amount) + SELECT vDate, SUM(amount) + FROM bi.defaulters + WHERE date = vDate and amount > 0; + + CALL vn.clientFreeze(); 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `userSetPassword` */; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `defaultingkk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -58169,30 +59957,2436 @@ ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `userSetPassword`(vUserName VARCHAR(255), vPassword VARCHAR(255)) +CREATE DEFINER=`root`@`%` PROCEDURE `defaultingkk`(IN vDate DATE) BEGIN -/** - * Cambia la contraseña del usuario pasado como parámetro. - * Solo los administradores deberian de tener privilegios de - * ejecución sobre el procedimiento ya que no solicita la - * contraseña actual del usuario. - * - * @param vUserName Nombre de usuario - * @param vPassword Nueva contraseña - */ - CALL userCheckPassword (vPassword); + DECLARE done BIT DEFAULT 0; + DECLARE vClient INT; + DECLARE vAmount INT; + DECLARE vDateInvoice DATE; + DECLARE vAmountInvoice DECIMAL(10,2); + DECLARE vDueDay INT; + DECLARE vGraceDays INT; + DECLARE defaulters CURSOR FOR + SELECT client, amount, Vencimiento, graceDays FROM bi.defaulters d + JOIN vn2008.Clientes c ON c.Id_Cliente = d.client + JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id + WHERE hasChanged AND date = vDate; + + DECLARE invoices CURSOR FOR + SELECT Fecha, importe FROM vn2008.Facturas f + WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + -- Control - UPDATE user SET - password = MD5(vPassword), - recoverPass = FALSE - WHERE `name` = vUserName; + INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); + + DELETE FROM bi.defaulters WHERE date = vDate; + + INSERT INTO bi.defaulters(client, date, amount) + SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount + FROM bi.customerRiskOverdue + GROUP BY customer_id; + + -- marcamos si ha cambiado y heredamos la fecha defaulterSince + UPDATE bi.defaulters d + JOIN ( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date = TIMESTAMPADD(DAY,-1, vDate) + GROUP BY client + ) yesterday using(client) + SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), + d.defaulterSince = yesterday.defaulterSince + WHERE d.date = vDate ; + + OPEN defaulters; + defaulters: BEGIN + REPEAT + FETCH defaulters INTO vClient,vAmount, vDueDay, vGraceDays; + OPEN invoices; + invoices:BEGIN + REPEAT + + FETCH invoices INTO vDateInvoice, vAmountInvoice; + IF TIMESTAMPADD(DAY, vGraceDays, vn2008.paymentday(vDateInvoice, vDueDay)) <= vDate THEN + SET vAmount = vAmount - vAmountInvoice; + IF vAmount < 0 THEN + UPDATE defaulters SET defaulterSince = vn2008.paymentday(vDateInvoice, vDueDay) + WHERE client = vClient and date = vDate; + SET vAmount = 0; + LEAVE invoices; + END IF; + END IF; + UNTIL done END REPEAT; + END invoices; + CLOSE invoices; + UNTIL done OR vClient IS NULL END REPEAT; + END defaulters; + CLOSE defaulters; + DELETE FROM bi.defaulting WHERE date = vDate; + + INSERT INTO bi.defaulting(date, amount) + SELECT vDate, SUM(amount) + FROM bi.defaulters + WHERE date = vDate and amount > 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 */ ; -ALTER DATABASE `account` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `defaulting_launcher` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `defaulting_launcher`() +BEGIN + + CALL bi.defaulting(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 DROP PROCEDURE IF EXISTS `equaliza` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `equaliza`(IN wh_id INT) +BEGIN + +DECLARE datEQ DATETIME; +/* JGF 2017-03-20 cuelga el sistema + +SELECT `date` INTO datEQ FROM bi.variables WHERE variable = IF(wh_id = 17,'eq_mcf','equalizator'); + + +IF TIMEDIFF(now(), datEQ) > '00:05:00' THEN + + UPDATE bi.Equalizator e + JOIN + ( + SELECT + Vista, + sum(1) as pedido, + sum(PedidoImpreso) as impreso, + sum(t.Factura IS NOT NULL + OR t.Etiquetasemitidas + OR nz(ticket_id) <> 0) as encajado + FROM + vn2008.Movimientos + JOIN + vn2008.Tickets t USING (Id_Ticket) + JOIN + vn2008.Agencias a ON t.Id_Agencia = a.Id_Agencia + JOIN + vn2008.Clientes C USING (Id_Cliente) + LEFT JOIN + (SELECT distinct + ticket_id + FROM + vn2008.expeditions e JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id WHERE Fecha >= curDate()) exp ON ticket_id = Id_Ticket + WHERE + invoice And Fecha >= curDate() + AND t.warehouse_id = wh_id + AND fecha < (TIMESTAMPADD(DAY, 1, CURDATE())) + GROUP BY Vista) sub using(Vista) + SET e.Pedido = sub.pedido, e.Impreso = sub.impreso, e.Encajado = sub.encajado; + + UPDATE bi.variables SET `date`= now() WHERE variable = IF(wh_id = 17,'eq_mcf','equalizator'); + + +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 DROP PROCEDURE IF EXISTS `facturacion_media_anual_update` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `facturacion_media_anual_update`() +BEGIN + +-- control +INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.facturacion_media_anual_update'); + +TRUNCATE TABLE bi.facturacion_media_anual; + +REPLACE bi.facturacion_media_anual(Id_Cliente, Consumo) +select Id_Cliente, avg(Consumo) +from ( + Select Id_Cliente, YEAR(fecha) year, MONTH(fecha) month, sum(importe) as Consumo + from bs.ventas + where fecha >= TIMESTAMPADD(YEAR,-1,CURDATE()) + group by Id_Cliente, year, month +) vol +group by Id_Cliente; + +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 DROP PROCEDURE IF EXISTS `greuge_dif_porte_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `greuge_dif_porte_add`() +BEGIN + +DECLARE datSTART DATETIME DEFAULT TIMESTAMPADD(DAY,-10,CURDATE()); +DECLARE datEND DATETIME DEFAULT TIMESTAMPADD(DAY,-1,CURDATE()); + + +DROP TEMPORARY TABLE IF EXISTS tmp.dp; + +CREATE TEMPORARY TABLE tmp.dp + (PRIMARY KEY (Id_Ticket)) + ENGINE = MEMORY + SELECT + t.Id_Ticket, + SUM(az.price * IF( + e.EsBulto = 71 + AND ISNULL(e.Id_Article) + AND a.Vista = 2, + 0.75, + 1 + ) + ) AS teorico, + 00000.00 as practico, + 00000.00 as greuge + FROM + vn2008.Tickets t + JOIN vn2008.Clientes cli ON cli.Id_cliente = t.Id_Cliente + LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.Id_Ticket + JOIN vn2008.Consignatarios c ON c.Id_Consigna = t.Id_Consigna + JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia + JOIN vn2008.Agencias_province ap ON t.warehouse_id = ap.warehouse_id + AND ap.province_id = c.province_id + AND ap.agency_id = a.agency_id + JOIN vn2008.Agencias_zonas az ON az.Id_Agencia = t.Id_Agencia + AND az.zona = ap.zona + AND t.warehouse_id = az.warehouse_id + AND az.Id_Article = e.EsBulto + WHERE + t.Fecha between datSTART AND datEND + AND cli.`real` + AND t.empresa_id IN (442 , 567) + GROUP BY t.Id_Ticket; + +DROP TEMPORARY TABLE IF EXISTS tmp.dp_aux; + +CREATE TEMPORARY TABLE tmp.dp_aux + (PRIMARY KEY (Id_Ticket)) + ENGINE = MEMORY + SELECT t.Id_Ticket, sum(freight) as porte + FROM tmp.dp + JOIN vn2008.Tickets t ON t.Id_Ticket = dp.Id_Ticket + JOIN vn2008.Rutas r on r.Id_Ruta = t.Id_Ruta + JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia + JOIN ( + SELECT + M.Id_Ticket, + (M.Cantidad * r.cm3 / cb.Volumen ) * az.price AS freight + FROM + vn2008.Movimientos M + JOIN vn2008.Tickets t ON t.Id_Ticket = M.Id_Ticket + JOIN vn2008.Consignatarios c ON c.Id_Consigna = t.Id_Consigna + JOIN bi.rotacion r ON M.Id_Article = r.Id_Article + AND t.warehouse_id = r.warehouse_id + JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia + JOIN vn2008.Agencias_province ap ON t.warehouse_id = ap.warehouse_id + AND ap.province_id = c.province_id + AND ap.agency_id = a.agency_id + JOIN vn2008.Agencias_zonas az ON az.Id_Agencia = t.Id_Agencia + AND az.zona = ap.zona + AND t.warehouse_id = az.warehouse_id + AND az.Id_Article = 71 + JOIN vn2008.Cubos cb ON Id_Cubo = 94 + WHERE t.Fecha between datSTART AND datEND + ) vmv ON vmv.Id_Ticket = t.Id_Ticket + WHERE a.is_volumetric + GROUP BY t.Id_Ticket; + + UPDATE tmp.dp + JOIN tmp.dp_aux using(Id_Ticket) + SET teorico = porte; + +DROP TEMPORARY TABLE IF EXISTS tmp.dp_aux; + +CREATE TEMPORARY TABLE tmp.dp_aux + (PRIMARY KEY (Id_Ticket)) + ENGINE = MEMORY + SELECT dp.Id_Ticket, sum(Cantidad * Valor) as valor + FROM tmp.dp + JOIN vn2008.Movimientos m using(Id_Ticket) + JOIN vn2008.Movimientos_componentes mc using(Id_Movimiento) + WHERE mc.Id_Componente = 15 + GROUP BY m.Id_Ticket; + +UPDATE tmp.dp + JOIN tmp.dp_aux using(Id_Ticket) + SET practico = valor; + +DROP TEMPORARY TABLE tmp.dp_aux; + +CREATE TEMPORARY TABLE tmp.dp_aux + (PRIMARY KEY (Id_Ticket)) + ENGINE = MEMORY + SELECT dp.Id_Ticket, sum(Importe) Importe + FROM tmp.dp + JOIN vn2008.Greuges g using(Id_Ticket) + WHERE Greuges_type_id = 1 + GROUP BY Id_Ticket; + +UPDATE tmp.dp + JOIN tmp.dp_aux using(Id_Ticket) + SET greuge = Importe; + + +INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) +SELECT t.Id_Cliente + , concat('dif_porte ', dp.Id_Ticket) + , round(teorico - practico - greuge,2) as Importe + , date(t.Fecha) + , 1 + ,t.Id_Ticket + FROM tmp.dp + JOIN vn2008.Tickets t on dp.Id_Ticket = t.Id_Ticket + WHERE ABS(teorico - practico - greuge) > 1; + + + + +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 DROP PROCEDURE IF EXISTS `Greuge_Evolution_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `Greuge_Evolution_Add`() +BEGIN + + /* + + Inserta en la tabla Greuge_Evolution el saldo acumulado de cada cliente, así como las ventas acumuladas en los ultimos 365 dias + , para poder controlar su evolucion + + */ + + DECLARE datFEC DATE; + DECLARE datFEC_TOMORROW DATE; + DECLARE datFEC_LASTYEAR DATE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + + GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SELECT CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto')); + INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('jgallego@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); + INSERT INTO vn2008.mail (`to`,`subject`,`text`) VALUES ('pako@verdnatura.es', 'Greuge_Evolution_Add' ,CONCAT('ERROR ', IFNULL(@errno,0), ': ', ifnull(@text,'texto'))); + + END; + + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('Greuge Evolution Add START'); + + SELECT TIMESTAMPADD(DAY,1,MAX(Fecha)), + TIMESTAMPADD(DAY,2,MAX(Fecha)) + INTO datFEC, + datFEC_TOMORROW + FROM bi.Greuge_Evolution; + + SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); + + DELETE FROM bi.Greuge_Evolution WHERE Fecha >= datFEC; + + DROP TEMPORARY TABLE IF EXISTS maxInvoice; + + 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 + HAVING maxFecha < timestampadd(month,-2,datFEC); + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('Greuge Evolution Add MIDDLE'); + + WHILE datFEC < CURDATE() DO + + REPLACE bi.Greuge_Evolution(Id_Cliente, Fecha, Greuge, Ventas) + + SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas + + FROM + + ( + SELECT Id_Cliente, sum(Importe) as Greuge + FROM vn2008.Greuges + where Fecha <= datFEC + group by Id_Cliente + + ) sub + + RIGHT JOIN + + ( + + SELECT Id_Cliente, sum(Ventas) as Ventas + FROM + ( + + SELECT Id_Cliente, IF (fecha != datFEC, -1,1) * (importe + recargo) as Ventas + FROM bs.ventas + WHERE fecha = datFEC or fecha = datFEC_LASTYEAR + + UNION ALL + + SELECT Id_Cliente, Ventas + FROM bi.Greuge_Evolution + WHERE Fecha = TIMESTAMPADD(DAY, -1, datFEC) + + ) sub + group by Id_Cliente + + ) v using(Id_Cliente) + ; + + + -- Ahora calcularemos el greuge muerto + + -- + UPDATE bi.Greuge_Evolution ge + JOIN maxInvoice m using(Id_Cliente) + SET FOSIL = GREUGE + WHERE m.maxFecha < TIMESTAMPADD(MONTH,-2,ge.Fecha); + + + -- Recobro + + UPDATE bi.Greuge_Evolution ge + JOIN ( + SELECT cs.Id_Cliente, sum(Valor * Cantidad) as Importe + FROM vn2008.Tickets t + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket + JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento + WHERE t.Fecha >= datFEC + AND t.Fecha < datFEC_TOMORROW + AND mc.Id_Componente = 17 -- Recobro + GROUP BY cs.Id_Cliente + ) sub using(Id_Cliente) + SET Recobro = Importe + WHERE ge.Fecha = datFEC; + + INSERT INTO vn2008.daily_task_log(consulta) VALUES(CONCAT('Greuge Evolution ',datFEC)); + + SET datFEC = datFEC_TOMORROW; + SET datFEC_TOMORROW = TIMESTAMPADD(DAY,1,datFEC_TOMORROW); + SET datFEC_LASTYEAR = TIMESTAMPADD(YEAR,-1,datFEC); + + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS maxInvoice; + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('Greuge Evolution Add END'); + +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 DROP PROCEDURE IF EXISTS `last_buy_id_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `last_buy_id_add`() +BEGIN + +-- control +-- INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.last_buy_id_add'); + +-- DELETE FROM bi.Last_buy_id; +TRUNCATE TABLE bi.Last_buy_id; + + +-- Primero metemos las del futuro, por si no hay en el presente + +INSERT INTO bi.Last_buy_id SELECT * FROM + (SELECT + Id_Article, Id_Compra, warehouse_id + FROM + vn2008.Compres c + JOIN vn2008.Entradas e USING (Id_Entrada) + JOIN vn2008.travel tr ON tr.id = e.travel_id + WHERE + Novincular = FALSE AND tarifa2 > 0 AND NOT Redada + AND landing > curdate() + ORDER BY landing DESC) t1 +GROUP BY Id_Article , warehouse_id; + +-- Ahora el presente machaca al futuro + +REPLACE bi.Last_buy_id SELECT * FROM + (SELECT + Id_Article, Id_Compra, warehouse_id + FROM + vn2008.Compres c + JOIN vn2008.Entradas e USING (Id_Entrada) + JOIN vn2008.travel tr ON tr.id = e.travel_id + WHERE + Novincular = FALSE AND tarifa2 > 0 AND NOT Redada + AND landing BETWEEN vn2008.date_inv() AND curdate() + ORDER BY landing DESC) t1 +GROUP BY Id_Article , warehouse_id; + + TRUNCATE TABLE bi.Last_buy_idBackUp; + INSERT INTO bi.Last_buy_idBackUp + SELECT * FROM Last_buy_id; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `margenes` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `margenes`() +BEGIN + +TRUNCATE TABLE bi.margenes; + +INSERT INTO bi.margenes +SELECT Id_Article, Cantidad as Unidades, Cantidad * round(nz(Costefijo) + nz(Embalajefijo) + nz(Comisionfija) + nz(Portefijo),3) as Coste , w.name as almacen, month(landing) as Mes, year(landing) as Year, 0 as Venta +FROM vn2008.Compres C +JOIN vn2008.Entradas E using(Id_Entrada) +JOIN vn2008.travel tr on tr.id = travel_id +JOIN vn2008.warehouse w on w.id = tr.warehouse_id +LEFT JOIN vn2008.Articles A using(Id_Article) +JOIN vn2008.Tipos TP using(tipo_id) +WHERE landing between '2013-01-01' and ' 2013-12-31' +AND E.Id_Proveedor <> 4 +AND not redada +AND not inventario +union all +SELECT Id_Article, Cantidad as Unidades, 0 as Coste , w.name, month(Fecha) as Mes, year(Fecha) as Year, Cantidad * round(Preu * (100 - M.Descuento) / 100,2) as Venta +FROM vn2008.Movimientos M +JOIN vn2008.Articles A using(Id_Article) +JOIN vn2008.Tipos TP using(tipo_id) +JOIN vn2008.Tickets T using(Id_Ticket) +JOIN vn2008.Clientes C using(Id_Cliente) +JOIN vn2008.warehouse w on w.id = warehouse_id +WHERE Fecha between '2013-01-01' and ' 2013-12-31' +AND (Id_Cliente = 31 or invoice) +AND Id_Cliente NOT IN (2066,2067,2068); + +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 DROP PROCEDURE IF EXISTS `nightly_tasks` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nightly_tasks`() +BEGIN + +call bi.analisis_ventas_evolution_add; + +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 DROP PROCEDURE IF EXISTS `nigthlyAnalisisVentas` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `nigthlyAnalisisVentas`() +BEGIN + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('analisis ventas START'); + + CALL bi.analisis_ventas_update; + CALL bi.analisis_ventas_simple; + CALL bi.analisis_ventas_evolution_add; + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('analisis ventas END'); + +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 DROP PROCEDURE IF EXISTS `partitioning` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `partitioning`(IN intyear INT) +BEGIN + + DECLARE v_sql TEXT; + DECLARE strSquemaName VARCHAR(10); + DECLARE strTableName VARCHAR(20); + DECLARE strFieldName VARCHAR(20); + DECLARE strDateField VARCHAR(20); + DECLARE strTableDependingOn VARCHAR(20); + DECLARE strFieldDependingOn VARCHAR(20); + DECLARE done BIT DEFAULT 0; + DECLARE strCacheSchema VARCHAR(5); + DECLARE dat_start,dat_end DATE; + DECLARE cur1 CURSOR FOR + SELECT `schema_name`,`table_name` FROM `cache`.partitioning_information ORDER BY execution_order; + DECLARE cur2 CURSOR FOR + SELECT `schema_name`,`table_name`,`date_field` FROM `cache`.partitioning_information WHERE date_field > '' ORDER BY execution_order; + DECLARE cur3 CURSOR FOR + SELECT `schema_name`,`table_name`,`table_depending` FROM `cache`.partitioning_information WHERE table_depending > '' ORDER BY execution_order; + DECLARE cur4 CURSOR FOR + SELECT `schema_name`,`table_name`,`table_depending` FROM `cache`.partitioning_information WHERE table_depending > '' ORDER BY execution_order DESC; + DECLARE cur5 CURSOR FOR + SELECT `schema_name`,`table_name`,`date_field` FROM `cache`.partitioning_information WHERE date_field > '' ORDER BY execution_order DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + + SET FOREIGN_KEY_CHECKS=0; + IF LENGTH(intyear) <> 4 THEN + CALL el_año_debe_contener_4_caracteres_yyyy(); + END IF; + SET dat_start = STR_TO_DATE(CONCAT('01,01,',intyear),'%d,%m,%Y'); + SET dat_end = STR_TO_DATE(CONCAT('31,12,',intyear),'%d,%m,%Y'); + SET strCacheSchema = CONCAT('vn_',right(intyear,2)); + SET v_sql = sql_printf ('CREATE SCHEMA IF NOT EXISTS %t',strCacheSchema); + CALL util.exec (v_sql); + + -- Insertamos en las tablas del cur1 + OPEN cur1; + FETCH cur1 INTO strSquemaName,strTableName; + WHILE NOT done DO + SET v_sql = sql_printf ('CREATE TABLE IF NOT EXISTS %t.%t LIKE %t.%t', + strCacheSchema, + strTableName, + strSquemaName, + strTableName); + + CALL util.exec (v_sql); + + FETCH cur1 INTO strSquemaName,strTableName; + + END WHILE; + CLOSE cur1; + + -- Insertamos en las tablas del cur2 + OPEN cur2; + FETCH cur2 INTO strSquemaName,strTableName,strDateField; + WHILE NOT done DO + SET v_sql = sql_printf ('REPLACE INTO %t.%t SELECT * FROM %t.%t WHERE %t BETWEEN %v AND %v', + strCacheSchema, + strTableName, + strSquemaName, + strTableName, + strDateField, + dat_start, + dat_end); + + SELECT v_sql; + CALL util.exec (v_sql); + + FETCH cur2 INTO strSquemaName,strTableName,strDateField; + + END WHILE; + CLOSE cur2; + + -- Insertamos en las tablas del cur3 + OPEN cur3; + SET done = 0; + FETCH cur3 INTO strSquemaName,strTableName,strTableDependingOn; + WHILE NOT done DO + + + -- Torna la columna per la qual vincular amb el seu pare + SELECT kcu.column_name INTO strFieldName + FROM information_schema.key_column_usage kcu + WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci + AND REFERENCED_TABLE_NAME = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci + AND table_name = CONVERT(strTableName USING utf8) COLLATE utf8_general_ci; + + -- Torna la columna per la qual vincular amb el seu fill + SELECT kcu.column_name INTO strFieldDependingOn + FROM information_schema.key_column_usage kcu + WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci -- FIX mirar l'esquema del pare + AND constraint_name = 'PRIMARY' + AND table_name = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci; + + SET v_sql = sql_printf ('REPLACE INTO %t.%t SELECT a.* FROM %t.%t a JOIN %t.%t b ON a.%t = b.%t', + strCacheSchema, + strTableName, + strSquemaName, + strTableName, + strCacheSchema, + strTableDependingOn, + strFieldName, + strFieldDependingOn); + select v_sql; + CALL util.exec (v_sql); + + FETCH cur3 INTO strSquemaName,strTableName,strTableDependingOn; + END WHILE; + + CLOSE cur3; + + -- Borramos en las tablas del cur4 que es igual que el dos pero en sentido descendente + -- para evitar errores con las foreign key + OPEN cur4; + SET done = 0; + FETCH cur4 INTO strSquemaName,strTableName,strTableDependingOn; + WHILE NOT done DO + + + -- Torna la columna per la qual vincular amb el seu pare + SELECT kcu.column_name INTO strFieldName + FROM information_schema.key_column_usage kcu + WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci + AND REFERENCED_TABLE_NAME = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci + AND table_name = CONVERT(strTableName USING utf8) COLLATE utf8_general_ci; + + -- Torna la columna per la qual vincular amb el seu fill + SELECT kcu.column_name INTO strFieldDependingOn + FROM information_schema.key_column_usage kcu + WHERE table_schema = CONVERT(strSquemaName USING utf8) COLLATE utf8_general_ci + AND constraint_name = 'PRIMARY' + AND table_name = CONVERT(strTableDependingOn USING utf8) COLLATE utf8_general_ci; + + SELECT v_sql; + SET v_sql = sql_printf ('DELETE a.* FROM %t.%t a JOIN %t.%t b ON a.%t = b.%t', + strSquemaName, + strTableName, + strCacheSchema, + strTableDependingOn, + strFieldName, + strFieldDependingOn); + CALL util.exec (v_sql); + + FETCH cur4 INTO strSquemaName,strTableName,strTableDependingOn; + END WHILE; + + CLOSE cur4; + + -- Borramos en las tablas del cur5 + OPEN cur5; + SET done = 0; + FETCH cur5 INTO strSquemaName,strTableName,strDateField; + WHILE NOT done DO + + SET v_sql = sql_printf ('DELETE FROM %t WHERE %t BETWEEN %v AND %v', + strTableName, + strDateField, + dat_start, + dat_end); + CALL util.exec (v_sql); + + FETCH cur5 INTO strSquemaName,strTableName,strDateField; + + END WHILE; + CLOSE cur5; + SET FOREIGN_KEY_CHECKS=1; +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 DROP PROCEDURE IF EXISTS `primer_pedido_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `primer_pedido_add`() +BEGIN + INSERT IGNORE INTO bi.primer_pedido(Id_Ticket, Id_Cliente, month, year, total) + SELECT * + FROM + (SELECT + `m`.`Id_Ticket` , + `v`.`Id_Cliente` , + `t`.`month`, + `t`.`year`, + v.importe + v.recargo as total + FROM + bs.ventas v + JOIN + vn2008.Movimientos m on m.Id_Movimiento = v.Id_Movimiento + JOIN + vn2008.time t on t.date = v.fecha + WHERE + fecha > CURDATE() + INTERVAL -(1) YEAR + ORDER BY fecha) `s` + GROUP BY `s`.`Id_Cliente`; +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 DROP PROCEDURE IF EXISTS `regularidad` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `regularidad`() +BEGIN + +select Id_Cliente, Meses, IF(Antiguedad = 13,12,Antiguedad) , Meses / IF(Antiguedad = 13,12,Antiguedad) as Regularidad from ( +SELECT Id_Cliente, count(*) as Meses, FLOOR(DATEDIFF('2012-07-31', IF(Created < '2011-08-01','2011-08-01', Created)) / 30) +1 as Antiguedad from +( + +SELECT DISTINCT Id_Cliente, Periodo(Fecha) as periodo from Facturas +where Fecha between '2011-08-01' AND '2012-07-31' + +) sub + +join Clientes using(Id_Cliente) +where Created <= '2012-07-31' + +group by Id_Cliente +having Antiguedad > 0 + +) sub44 +order by Antiguedad ; + + +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 DROP PROCEDURE IF EXISTS `rotacion_update` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update`() +BEGIN + +-- control +INSERT INTO vn2008.daily_task_log(consulta) VALUES('bi.rotation_update'); + +-- Sólo hace la consulta gorda los sábados de madrugada. Necesita casi dos horas. + + call rotacion_update_manual(1, 999999, TIMESTAMPADD(WEEK,-1,CURDATE()), 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 DROP PROCEDURE IF EXISTS `rotacion_update_manual` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update_manual`(IN intART_DESDE INT, IN intART_HASTA INT, IN datSTART DATE, IN datEND DATE) +BEGIN + + +DECLARE intLAPSO INT DEFAULT DATEDIFF(datEND,datSTART ); + + + + + REPLACE bi.rotacion(Id_Article,warehouse_id,total,rotacion) + SELECT Id_Article, warehouse_id, Total, round((sum(Saldo_Ponderado)/Total),2) as rotacion -- round(avg(Saldo_Ponderado) / (Total / intLAPSO),1) as Rotacion + FROM + ( + SELECT Id_Article, warehouse_id, + @intervalo:= IF(warehouse_id = @wh AND Id_Article = @art , DATEDIFF(Fecha, @fec),1) as Dias, + IF(warehouse_id = @wh AND Id_Article = @art , IF(@sd < 0,0,@sd) * @intervalo, IF(Unidades<0,0,Unidades)) as Saldo_Ponderado, + IF(warehouse_id = @wh AND Id_Article = @art , @sd:= @sd + Unidades, @sd:= Unidades) as Saldo + + , @fec:= Fecha, @art:= Id_Article, @wh:= warehouse_id + FROM + ( + SELECT Id_Article, landing as Fecha, sum(Cantidad) as Unidades, warehouse_id, @fec:= datSTART, @art := 0, @d := 0, @sd:= 0, @wh := 0, @intervalo := 0 + FROM + ( + SELECT Id_Article, landing, Cantidad, warehouse_id + FROM vn2008.Compres C + JOIN vn2008.Entradas E using(Id_Entrada) + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + JOIN vn2008.travel tr on tr.id = travel_id + JOIN vn2008.warehouse w on w.id = tr.warehouse_id + WHERE landing between datSTART and datEND + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Proveedor <> 4 + AND r.display <> 0 + AND NOT E.Inventario + AND NOT fuente + AND NOT redada + UNION ALL + SELECT Id_Article, shipment, -Cantidad, warehouse_id_out + FROM vn2008.Compres C + JOIN vn2008.Entradas E using(Id_Entrada) + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + JOIN vn2008.travel tr on tr.id = travel_id + JOIN vn2008.warehouse w on w.id = tr.warehouse_id_out + WHERE shipment between datSTART and datEND + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Proveedor <> 4 + AND r.display <> 0 + AND NOT fuente + AND NOT E.Inventario + AND NOT redada + UNION ALL + SELECT Id_Article, date(Fecha), -Cantidad, warehouse_id + FROM vn2008.Movimientos M + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + JOIN vn2008.Tickets t using(Id_Ticket) + JOIN vn2008.warehouse w on w.id = t.warehouse_id + WHERE Fecha between datSTART and datEND + AND r.display <> 0 + AND NOT fuente + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Cliente NOT IN (2066,2067,2068) + ) sub + GROUP BY Id_Article, warehouse_id, Fecha + ) sub2 + ) sub4 + JOIN + ( + SELECT Id_Article, sum(Cantidad) as Total, warehouse_id + FROM vn2008.Compres C + JOIN vn2008.Entradas E using(Id_Entrada) + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos tp ON tp.tipo_id = A.tipo_id + LEFT JOIN vn2008.reinos r ON r.id = tp.reino_id + JOIN vn2008.travel tr on tr.id = travel_id + JOIN vn2008.warehouse w on w.id = tr.warehouse_id + WHERE landing between datSTART and datEND + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Proveedor <> 4 + AND NOT E.Inventario + AND r.display <> 0 + AND NOT redada + AND NOT fuente + GROUP BY Id_Article, warehouse_id + ) sub3 using(Id_Article, warehouse_id) + + GROUP BY Id_Article, warehouse_id; + + + + CALL vn2008.item_last_buy_(NULL,datSTART); + + -- Añadimos el volumen por unidad de venta + update bi.rotacion r + JOIN vn2008.t_item_last_buy b ON r.Id_Article = b.item_id AND r.warehouse_id = b.warehouse_id + join vn2008.Compres ON Id_Compra = b.buy_id + set cm3 = vn2008.cm3_2(Id_Cubo, r.Id_Article) / Packing + where r.Id_Article between intART_DESDE and intART_HASTA; + +-- Añadimos el coste de almacenamiento y manipulacion +UPDATE bi.rotacion +JOIN ( + SELECT warehouse_id, sum(total*rotacion*cm3) as Operacion + FROM bi.rotacion + WHERE Id_Article between intART_DESDE and intART_HASTA + GROUP BY warehouse_id + ) sub using(warehouse_id) + +JOIN ( + SELECT warehouse_id, sum(Valor) as Coste_Auxiliar + FROM bi.tarifa_warehouse + WHERE Id_Premisa = 1 + GROUP BY warehouse_id + ) sub2 using(warehouse_id) + +JOIN ( + SELECT warehouse_id, sum(Valor) as Coste_Operativo + FROM bi.tarifa_warehouse + WHERE Id_Premisa IN (2,3) + GROUP BY warehouse_id + ) sub3 using(warehouse_id) + +JOIN ( + SELECT warehouse_id, sum(Valor) as Coste_Manipulacion + FROM bi.tarifa_warehouse + WHERE Id_Premisa = 4 + GROUP BY warehouse_id + ) sub4 using(warehouse_id) + +SET auxiliar = if(rotacion < 0,0,round(rotacion *cm3 * Coste_Auxiliar / Operacion,4)) + ,almacenaje = if(rotacion < 0,0,round(rotacion *cm3 * Coste_Operativo / Operacion,4)) + , manipulacion = if(rotacion < 0,0,round(rotacion *cm3 * Coste_Manipulacion / Operacion,4)) + WHERE Id_Article between intART_DESDE and intART_HASTA; + + +-- Añadimos todos los productos de los que no tenemos histórico, con la media de su familia como valor por defecto + +INSERT INTO bi.rotacion(Id_Article, warehouse_id, rotacion, cm3, almacenaje, manipulacion, auxiliar, mermas) +SELECT a.Id_Article, warehouse_id, rotacion_m, cm3_m, alm_m, man_m, aux_m, merm_m +FROM vn2008.Articles a +JOIN (SELECT tipo_id, warehouse_id, Id_Tipo, avg(rotacion) rotacion_m, avg(cm3) cm3_m, avg(almacenaje) alm_m, avg(manipulacion) man_m + , avg(auxiliar) aux_m, avg(mermas) merm_m + from bi.rotacion + join vn2008.Articles a using(Id_Article) + join vn2008.Tipos tp using(tipo_id) + group by tipo_id, warehouse_id) sub using(tipo_id) + +WHERE a.Id_Article between intART_DESDE and intART_HASTA +ON DUPLICATE KEY UPDATE rotacion = rotacion; + +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 DROP PROCEDURE IF EXISTS `rotacion_update_manual_PCA` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `rotacion_update_manual_PCA`(IN datSTART DATE, IN datEND DATE) +BEGIN + + +DECLARE intLAPSO INT DEFAULT DATEDIFF(datEND,datSTART ); +DECLARE intART_DESDE BIGINT DEFAULT 1; +DECLARE intART_HASTA BIGINT DEFAULT 100; + +WHILE intART_HASTA < 999999 DO + + IF intART_HASTA MOD 1000 = 0 THEN + + SELECT intART_HASTA; + + END IF; + + REPLACE bi.rotacion(Id_Article,warehouse_id,total,rotacion) + SELECT Id_Article, warehouse_id, Total, round((sum(Saldo_Ponderado)/Total),2) as rotacion -- round(avg(Saldo_Ponderado) / (Total / intLAPSO),1) as Rotacion + FROM + ( + SELECT Id_Article, warehouse_id, + @intervalo:= IF(warehouse_id = @wh AND Id_Article = @art , DATEDIFF(Fecha, @fec),1) as Dias, + IF(warehouse_id = @wh AND Id_Article = @art , IF(@sd < 0,0,@sd) * @intervalo, IF(Unidades<0,0,Unidades)) as Saldo_Ponderado, + IF(warehouse_id = @wh AND Id_Article = @art , @sd:= @sd + Unidades, @sd:= Unidades) as Saldo + + , @fec:= Fecha, @art:= Id_Article, @wh:= warehouse_id + FROM + ( + SELECT Id_Article, landing as Fecha, sum(Cantidad) as Unidades, warehouse_id, @fec:= datSTART, @art := 0, @d := 0, @sd:= 0, @wh := 0, @intervalo := 0 + FROM + ( + SELECT Id_Article, landing, Cantidad, warehouse_id + FROM vn2008.Compres C + JOIN vn2008.Entradas E using(Id_Entrada) + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos using(tipo_id) + JOIN vn2008.travel tr on tr.id = travel_id + JOIN vn2008.warehouse w on w.id = tr.warehouse_id + WHERE landing between datSTART and datEND + AND warehouse_id = 44 + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Proveedor <> 4 + AND reino_id IN (3,4) + AND NOT E.Inventario + AND NOT fuente + AND NOT redada + UNION ALL + SELECT Id_Article, shipment, -Cantidad, warehouse_id_out + FROM vn2008.Compres C + JOIN vn2008.Entradas E using(Id_Entrada) + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos using(tipo_id) + JOIN vn2008.travel tr on tr.id = travel_id + JOIN vn2008.warehouse w on w.id = tr.warehouse_id_out + WHERE shipment between datSTART and datEND + AND warehouse_id_out = 44 + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Proveedor <> 4 + AND reino_id IN (3,4) + AND NOT fuente + AND NOT E.Inventario + AND NOT redada + UNION ALL + SELECT Id_Article, date(Fecha), -Cantidad, warehouse_id + FROM vn2008.Movimientos M + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos using(tipo_id) + JOIN vn2008.Tickets t using(Id_Ticket) + JOIN vn2008.warehouse w on w.id = t.warehouse_id + WHERE Fecha between datSTART and datEND + AND t.warehouse_id = 44 + AND reino_id IN (3,4) + AND NOT fuente + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Cliente NOT IN (2066,2067,2068) + ) sub + GROUP BY Id_Article, warehouse_id, Fecha + ) sub2 + ) sub4 + JOIN + ( + SELECT Id_Article, sum(Cantidad) as Total, warehouse_id + FROM vn2008.Compres C + JOIN vn2008.Entradas E using(Id_Entrada) + JOIN vn2008.Articles A using(Id_Article) + JOIN vn2008.Tipos using(tipo_id) + JOIN vn2008.travel tr on tr.id = travel_id + JOIN vn2008.warehouse w on w.id = tr.warehouse_id + WHERE landing between datSTART and datEND + AND warehouse_id = 44 + AND Id_Article between intART_DESDE and intART_HASTA + AND Id_Proveedor <> 4 + AND NOT E.Inventario + AND reino_id IN (3,4) + AND NOT redada + AND NOT fuente + GROUP BY Id_Article, warehouse_id + ) sub3 using(Id_Article, warehouse_id) + GROUP BY Id_Article, warehouse_id; + +SET intART_DESDE = intART_DESDE + 100; +SET intART_DESDE = intART_HASTA + 100; + +END WHILE; + + +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 DROP PROCEDURE IF EXISTS `rotacion_volumen_update` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-developer`@`%` PROCEDURE `rotacion_volumen_update`() +BEGIN + + CALL vn2008.item_last_buy_(NULL,curdate()); + + -- Añadimos el volumen por unidad de venta + update bi.rotacion r + JOIN vn2008.t_item_last_buy b ON r.Id_Article = b.item_id AND r.warehouse_id = b.warehouse_id + join vn2008.Compres ON Id_Compra = b.buy_id + set cm3 = vn2008.cm3_2(Id_Cubo, r.Id_Article) / Packing; + +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 DROP PROCEDURE IF EXISTS `rutas_m3_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `rutas_m3_add`() +BEGIN + + DECLARE datSTART DATE DEFAULT TIMESTAMPADD(DAY,-90,CURDATE()); + DECLARE datEND DATE DEFAULT CURDATE(); + DECLARE datFEC DATE; + + IF hour(now()) between 5 and 24 then + + SET datSTART = CURDATE(); + SET datEND = TIMESTAMPADD(DAY,1,CURDATE()); + + end if; + + SET datFEC = datSTART; + + CALL vn2008.item_last_buy_(NULL,CURDATE()); + WHILE datFEC <= datEND DO + + UPDATE vn2008.Rutas R + JOIN (SELECT R.Id_Ruta, sum(Cantidad * vn2008.cm3_unidad(b.buy_id)) / 1000000 as m3 + from vn2008.Rutas R + join vn2008.Tickets t using(Id_Ruta) + join vn2008.Movimientos m using(Id_Ticket) + join vn2008.t_item_last_buy b ON Id_Article = b.item_id AND b.warehouse_id = t.warehouse_id + where R.Fecha = datFEC AND R.m3 IS NULL + group by R.Id_Ruta + ) t using(Id_Ruta) + SET R.m3 = t.m3 + WHERE R.m3 IS NULL; + + SET datFEC = TIMESTAMPADD(DAY,1,datFEC); + + END WHILE; + +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 DROP PROCEDURE IF EXISTS `ticket_add2kk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_add2kk`(intNUMDAYS INTEGER) +BEGIN + +DECLARE datSTART,datEND DATETIME; +-- Seleccionamos los tickets a tratar añadiendolos a la tabla bi.ticket + + SET @@session.max_sp_recursion_depth=250; -- Habilito la recursión en mysql hasta un límite de 250. + SET datSTART = TIMESTAMPADD(DAY, -intNUMDAYS, CURDATE()); + + + SET datEND = vn2008.DAYEND(datSTART); + + + + + -- Actualiza el valor de costfixat en Movimientos a efectos estadisticos +update vn2008.Movimientos m +join +( +select Id_Movimiento, round(IFNULL(sum(Valor) , IFNULL( Preu * (100 - m.Descuento) /100,0 ) ),2) as Cost +from vn2008.Tickets t +join vn2008.Movimientos m using(Id_Ticket) +left join vn2008.Movimientos_componentes mc using(Id_Movimiento) +join bi.tarifa_componentes tc using(Id_Componente) +join bi.tarifa_componentes_series tcs on tcs.tarifa_componentes_series_id = tc.tarifa_componentes_series_id AND tcs.base +where t.Fecha between datSTART AND datEND +group by Id_Movimiento +) sub using(Id_Movimiento) +set CostFixat = Cost; + + + + + REPLACE INTO bi.ticket(Id_Ticket,Id_Cliente,`date`, tipo_id, `year`,`week`,`month`,`day`,`view`,amount,Id_Trabajador,Id_propietario ) + SELECT t.Id_Ticket,c.Id_Cliente,t.Fecha `date`,tipo_id, year(Fecha) as `year`, vn2008.vnweek(Fecha) as `week`, + month(Fecha) as `month`,vn2008.vnday(Fecha) as `day`, A.Vista `view`, + IFNULL( round( sum(cantidad * Preu * (100 - m.Descuento)/100) ,2) ,0) as amount, + c.Id_Trabajador, c.Id_Trabajador + FROM vn2008.Tickets t + JOIN vn2008.Consignatarios cs using(Id_Consigna) + JOIN vn2008.warehouse W ON W.id = t.warehouse_id + INNER JOIN vn2008.Clientes c on cs.Id_Cliente = c.Id_Cliente + INNER JOIN vn2008.Movimientos m USING(Id_Ticket) + INNER JOIN vn2008.Articles USING(Id_Article) + INNER JOIN vn2008.Agencias A on A.Id_Agencia = t.Id_Agencia + INNER JOIN vn2008.Tipos TP USING(tipo_id) + WHERE Fecha BETWEEN datSTART AND datEND + AND NOT W.fuente + AND c.`Real` + AND (reino_id <> 6 OR m.Id_Article IN (95,98)) + GROUP BY t.Id_Ticket,tipo_id ; + + /* + UPDATE bi.ticket + JOIN vn2008.Tickets using(Id_Ticket) + JOIN vn2008.Agencias using(Id_Agencia) + JOIN vn2008.agency_warehouse aw using(agency_id,warehouse_id) + SET `view` = aw.Vista + WHERE Tickets.Fecha BETWEEN datSTART AND datEND; + */ + + + + IF (intNUMDAYS>0) THEN + CALL `bi`.`ticket_add2` (intNUMDAYS-1); + 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 DROP PROCEDURE IF EXISTS `ticket_addkk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_addkk`(intNUMDAYS INTEGER) +BEGIN + +DECLARE datSTART DATETIME; + + IF (intNUMDAYS > 0) THEN + SET datSTART = TIMESTAMPADD(DAY, -intNUMDAYS, CURDATE()); + DELETE FROM bi.ticket where `date` >= datSTART ; + CALL `bi`.`ticket_add2` (intNUMDAYS); + DELETE FROM bi.ticket where `date` < '2001-01-01'; + END IF; + +UPDATE bi.ticket bt +JOIN vn2008.Tickets USING(Id_Ticket) +JOIN vn2008.Consignatarios C USING(Id_Consigna) +SET bt.Id_Cliente = C.Id_Cliente +, bt.Id_Trabajador = @idT := vn2008.Averiguar_ComercialCliente_Id(C.Id_Cliente,bt.date) +, bt.Id_propietario = @idT +WHERE Tickets.Id_Cliente = 31 AND bt.date >= datSTART; + + +-- Almacena los tickets que comisionan, para consultas rapidas + +truncate table bi.f_tvc; + +insert into bi.f_tvc +select Id_Ticket +from vn2008.Tickets t +join vn2008.Consignatarios cs using(Id_Consigna) +join vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente +join vn2008.warehouse w on w.id = t.warehouse_id +where c.`Real` = TRUE +and w.comisionantes = TRUE; + + + + +-- Quita las horas de los tickets del mes anterior +IF DAY(CURDATE()) = 15 THEN + update vn2008.Tickets + set Fecha = date(Fecha) + where Fecha between TIMESTAMPADD(DAY,-46,CURDATE()) and TIMESTAMPADD(DAY, -1 - DAY(CURDATE()), CURDATE()); + 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 DROP PROCEDURE IF EXISTS `ticket_add_bydaykk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `ticket_add_bydaykk`(datFEC DATE) +BEGIN + + DECLARE datSTART DATETIME; + DECLARE datEND DATETIME; + +-- Seleccionamos los tickets a tratar añadiendolos a la tabla bi.ticket + + SET @@session.max_sp_recursion_depth=2500; -- Habilito la recursión en mysql hasta un límite de 2500. + + SET datSTART = DATE(datFEC); + SET datEND = TIMESTAMPADD(DAY,30,datSTART); + + DELETE FROM bi.ticket WHERE `date` between datSTART and datEND; + + INSERT INTO bi.ticket(Id_Ticket,`date`, tipo_id, `year`,`week`,`month`,`view`,amount,Id_Trabajador, Id_Cliente, Id_Propietario ) + SELECT t.Id_Ticket,t.Fecha `date`,tipo_id, vn2008.vnyear(Fecha) as `year`, vn2008.vnweek(Fecha) as `week`, + vn2008.vnmonth(Fecha) as `month`, A.Vista `view`, IFNULL(round(sum(cantidad * preu * (100 - m.Descuento)/100),2),0) as amount, + c.Id_Trabajador, c.Id_Cliente, ifnull(c.Id_Trabajador,20) + FROM vn2008.Tickets t + JOIN vn2008.Consignatarios cs using(Id_Consigna) + JOIN vn2008.warehouse W ON W.id = t.warehouse_id + INNER JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente + INNER JOIN vn2008.Movimientos m USING(Id_Ticket) + INNER JOIN vn2008.Articles USING(Id_Article) + INNER JOIN vn2008.Agencias A on A.Id_Agencia = t.Id_Agencia + INNER JOIN vn2008.Tipos TP USING(tipo_id) + LEFT JOIN vn2008.reinos r ON r.id = TP.reino_id + WHERE Fecha >= datSTART + AND Fecha < datEND + AND NOT W.fuente + AND (invoice or t.Id_Cliente in (5,31)) + AND r.display <> 0 + GROUP BY t.Id_Ticket,tipo_id + ON DUPLICATE KEY UPDATE amount = amount, + `view` = `view`, + `date` = `date`, + `week` = `week`, + `year` = `year`, + `month` = `month`, + tipo_id = tipo_id, + Id_Trabajador = Id_Trabajador, + Id_Cliente = Id_Cliente, + Id_Propietario = ifnull(Id_Trabajador,20); + + UPDATE bi.ticket + JOIN vn2008.Tickets using(Id_Ticket) + JOIN vn2008.Agencias using(Id_Agencia) + JOIN vn2008.agency_warehouse aw using(agency_id,warehouse_id) + SET `view` = aw.Vista + WHERE Tickets.Fecha BETWEEN datSTART AND datEND; + +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 DROP PROCEDURE IF EXISTS `Ultima_Accion` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `Ultima_Accion`() +BEGIN + +REPLACE INTO bi.lastaction(Id_Cliente, Cliente, Ultima_accion, Comercial) + +SELECT Id_Cliente, Cliente, Ultima_accion, Comercial +FROM vn2008.Clientes +JOIN +( +SELECT Id_Cliente, MAX(calldate) as Ultima_accion, vn2008.Averiguar_ComercialCliente(Id_Cliente, CURDATE()) as Comercial +FROM +( +SELECT Id_Cliente, calldate +FROM vn2008.cdr +JOIN vn2008.Contactos CT on CT.Telefono = dst +JOIN vn2008.Relaciones using(Id_Contacto) +WHERE Id_Cliente IS NOT NULL +AND duration > 30 +UNION ALL +SELECT Id_Cliente, calldate +FROM vn2008.cdr +JOIN vn2008.Contactos CT on CT.Movil = dst +JOIN vn2008.Relaciones using(Id_Contacto) +WHERE Id_Cliente IS NOT NULL +AND duration > 30 +UNION ALL +SELECT Id_Cliente, calldate +FROM vn2008.cdr +JOIN vn2008.Clientes CT on CT.Telefono = dst +WHERE duration > 30 +UNION ALL +SELECT Id_Cliente, calldate +FROM vn2008.cdr +JOIN vn2008.Clientes CT on CT.Movil = dst +WHERE duration > 30 +UNION ALL +SELECT C.Id_Cliente, Fecha +FROM vn2008.Tickets JOIN vn2008.Consignatarios C using(Id_Consigna) +) sub +GROUP BY Id_Cliente ) sub2 USING(Id_Cliente); +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 DROP PROCEDURE IF EXISTS `Velocity_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `Velocity_Add`() +BEGIN + +DECLARE bol_EXISTS BOOL; +DECLARE datMAX DATETIME; +DECLARE v_buffer VARCHAR(11); +DECLARE v_sql VARCHAR(255); + + + +SELECT MAX(Fecha) INTO datMAX FROM bi.Velocity; + +IF Date(datMAX) = CURDATE() AND hour(datMAX) > hour(now()) THEN + + + SET v_buffer = vn2008.buffer_name(CURDATE(),1); + + SELECT count(*) INTO bol_EXISTS FROM information_schema.`TABLES` + WHERE TABLE_NAME = CONVERT(v_buffer using utf8) collate utf8_general_ci; + + IF bol_EXISTS THEN + + SET v_sql = sql_printf ( + 'INSERT INTO bi.Velocity(tipo_id, Fecha, Disponible, Visible) + SELECT A.tipo_id, NOW(), sum(avalaible), sum(visible) + FROM vn2008.%t b + JOIN Articles A ON b.item_id = A.Id_Article GROUP BY tipo_id; + ', + v_buffer + ); + + + CALL util.exec (v_sql); + + END IF; + +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 */ ; + +-- +-- Current Database: `pbx` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `pbx` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `pbx`; + +-- +-- Table structure for table `blacklist` +-- + +DROP TABLE IF EXISTS `blacklist`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `blacklist` ( + `phone` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`phone`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Hangup input calls from this list'; +/*!40101 SET character_set_client = @saved_cs_client */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`blacklistBeforeInsert` +BEFORE INSERT ON `blacklist` FOR EACH ROW +BEGIN + CALL phoneIsValid (NEW.phone); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`blacklistBerforeUpdate` +BEFORE UPDATE ON `blacklist` FOR EACH ROW +BEGIN + CALL phoneIsValid (NEW.phone); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + +-- +-- Table structure for table `cdr` +-- + +DROP TABLE IF EXISTS `cdr`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cdr` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `call_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `clid` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `src` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `dst` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `dcontext` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `dst_channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `last_app` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `last_data` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `duration` int(11) NOT NULL DEFAULT '0', + `billsec` int(11) NOT NULL DEFAULT '0', + `disposition` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `ama_flags` int(11) NOT NULL DEFAULT '0', + `account_code` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `unique_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `user_field` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `calldate` (`call_date`), + KEY `dst` (`dst`), + KEY `accountcode` (`account_code`), + KEY `dstchannel` (`dst_channel`), + KEY `disposition` (`disposition`), + KEY `src` (`src`) +) ENGINE=MyISAM AUTO_INCREMENT=178501 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `cdrConf` +-- + +DROP TABLE IF EXISTS `cdrConf`; +/*!50001 DROP VIEW IF EXISTS `cdrConf`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `cdrConf` ( + `calldate` tinyint NOT NULL, + `clid` tinyint NOT NULL, + `src` tinyint NOT NULL, + `dst` tinyint NOT NULL, + `dcontext` tinyint NOT NULL, + `channel` tinyint NOT NULL, + `dstchannel` tinyint NOT NULL, + `lastapp` tinyint NOT NULL, + `lastdata` tinyint NOT NULL, + `duration` tinyint NOT NULL, + `billsec` tinyint NOT NULL, + `disposition` tinyint NOT NULL, + `amaflags` tinyint NOT NULL, + `accountcode` tinyint NOT NULL, + `uniqueid` tinyint NOT NULL, + `userfield` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `config` +-- + +DROP TABLE IF EXISTS `config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `config` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `sundayFestive` tinyint(4) NOT NULL, + `countryPrefix` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `followme` +-- + +DROP TABLE IF EXISTS `followme`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `followme` ( + `extension` varchar(128) CHARACTER SET utf8 NOT NULL, + `phone` varchar(20) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`extension`), + CONSTRAINT `followme_ibfk_1` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`followmeBeforeInsert` +BEFORE INSERT ON `followme` FOR EACH ROW +BEGIN + CALL pbx.phoneIsValid (NEW.phone); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`followmeBeforeUpdate` +BEFORE UPDATE ON `followme` FOR EACH ROW +BEGIN + CALL pbx.phoneIsValid (NEW.phone); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + +-- +-- Temporary table structure for view `followmeConf` +-- + +DROP TABLE IF EXISTS `followmeConf`; +/*!50001 DROP VIEW IF EXISTS `followmeConf`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `followmeConf` ( + `name` tinyint NOT NULL, + `music` tinyint NOT NULL, + `context` tinyint NOT NULL, + `takecall` tinyint NOT NULL, + `declinecall` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `followmeConfig` +-- + +DROP TABLE IF EXISTS `followmeConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `followmeConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `music` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `context` varchar(50) CHARACTER SET utf8 NOT NULL, + `takeCall` char(1) CHARACTER SET utf8 NOT NULL, + `declineCall` char(1) CHARACTER SET utf8 NOT NULL, + `timeout` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `followmeNumberConf` +-- + +DROP TABLE IF EXISTS `followmeNumberConf`; +/*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `followmeNumberConf` ( + `name` tinyint NOT NULL, + `ordinal` tinyint NOT NULL, + `phonenumber` tinyint NOT NULL, + `timeout` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `queue` +-- + +DROP TABLE IF EXISTS `queue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `queue` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `description` varchar(128) CHARACTER SET utf8 NOT NULL, + `name` varchar(128) CHARACTER SET utf8 NOT NULL, + `config` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`), + UNIQUE KEY `description` (`description`), + KEY `config` (`config`), + CONSTRAINT `queue_ibfk_1` FOREIGN KEY (`config`) REFERENCES `queueConfig` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; +/*!40101 SET character_set_client = @saved_cs_client */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queueBeforeInsert` +BEFORE INSERT ON `queue` FOR EACH ROW +BEGIN + CALL queueIsValid (NEW.name); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queueBeforeUpdate` +BEFORE UPDATE ON `queue` FOR EACH ROW +BEGIN + CALL queueIsValid (NEW.name); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + +-- +-- Temporary table structure for view `queueConf` +-- + +DROP TABLE IF EXISTS `queueConf`; +/*!50001 DROP VIEW IF EXISTS `queueConf`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `queueConf` ( + `name` tinyint NOT NULL, + `strategy` tinyint NOT NULL, + `timeout` tinyint NOT NULL, + `retry` tinyint NOT NULL, + `weight` tinyint NOT NULL, + `maxlen` tinyint NOT NULL, + `ringinuse` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `queueConfig` +-- + +DROP TABLE IF EXISTS `queueConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `queueConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `strategy` varchar(128) CHARACTER SET utf8 NOT NULL, + `timeout` int(10) unsigned NOT NULL, + `retry` int(10) unsigned NOT NULL, + `weight` int(10) unsigned NOT NULL, + `maxLen` int(10) unsigned NOT NULL, + `ringInUse` tinyint(4) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `queueMember` +-- + +DROP TABLE IF EXISTS `queueMember`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `queueMember` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `queue` varchar(128) CHARACTER SET utf8 NOT NULL, + `extension` varchar(128) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `queue` (`queue`,`extension`), + KEY `extension` (`extension`), + CONSTRAINT `queueMember_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `queueMember_ibfk_2` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=723 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `queueMemberConf` +-- + +DROP TABLE IF EXISTS `queueMemberConf`; +/*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `queueMemberConf` ( + `uniqueid` tinyint NOT NULL, + `queue_name` tinyint NOT NULL, + `interface` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `queuePhone` +-- + +DROP TABLE IF EXISTS `queuePhone`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `queuePhone` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `queue` varchar(128) CHARACTER SET utf8 NOT NULL, + `phone` varchar(128) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `queue` (`queue`,`phone`), + CONSTRAINT `queuePhone_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1003 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queuePhoneBeforeInsert` +BEFORE INSERT ON `queuePhone` FOR EACH ROW +BEGIN + CALL phoneIsValid (NEW.phone); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queuePhoneBeforeUpdate` +BEFORE UPDATE ON `queuePhone` FOR EACH ROW +BEGIN + CALL phoneIsValid (NEW.phone); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + +-- +-- Table structure for table `schedule` +-- + +DROP TABLE IF EXISTS `schedule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `schedule` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `weekDay` tinyint(3) unsigned NOT NULL COMMENT '0 = Monday, 6 = Sunday', + `timeStart` time NOT NULL, + `timeEnd` time NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sip` +-- + +DROP TABLE IF EXISTS `sip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sip` ( + `user_id` int(10) unsigned NOT NULL DEFAULT '0', + `extension` varchar(128) CHARACTER SET utf8 NOT NULL, + `secret` varchar(80) CHARACTER SET utf8 NOT NULL, + `caller_id` varchar(80) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`user_id`), + UNIQUE KEY `extension` (`extension`), + CONSTRAINT `sip_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SIP accounts'; +/*!40101 SET character_set_client = @saved_cs_client */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`sipBeforeInsert` +BEFORE INSERT ON `sip` FOR EACH ROW +BEGIN + CALL extensionIsValid (NEW.extension); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `sipAfterInsert` +AFTER INSERT ON `sip` FOR EACH ROW +BEGIN + INSERT INTO sipReg (userId) VALUES (NEW.user_id); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`sipBeforeUpdate` +BEFORE UPDATE ON `sip` FOR EACH ROW +BEGIN + CALL extensionIsValid (NEW.extension); +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + +-- +-- Temporary table structure for view `sipConf` +-- + +DROP TABLE IF EXISTS `sipConf`; +/*!50001 DROP VIEW IF EXISTS `sipConf`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `sipConf` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `secret` tinyint NOT NULL, + `callerid` tinyint NOT NULL, + `host` tinyint NOT NULL, + `deny` tinyint NOT NULL, + `permit` tinyint NOT NULL, + `type` tinyint NOT NULL, + `context` tinyint NOT NULL, + `incominglimit` tinyint NOT NULL, + `pickupgroup` tinyint NOT NULL, + `careinvite` tinyint NOT NULL, + `ipaddr` tinyint NOT NULL, + `regseconds` tinyint NOT NULL, + `port` tinyint NOT NULL, + `defaultuser` tinyint NOT NULL, + `useragent` tinyint NOT NULL, + `lastms` tinyint NOT NULL, + `fullcontact` tinyint NOT NULL, + `regserver` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `sipConfig` +-- + +DROP TABLE IF EXISTS `sipConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sipConfig` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `host` varchar(40) CHARACTER SET utf8 DEFAULT NULL, + `deny` varchar(95) CHARACTER SET utf8 NOT NULL, + `permit` varchar(95) CHARACTER SET utf8 NOT NULL, + `type` enum('user','peer','friend') CHARACTER SET utf8 NOT NULL, + `context` varchar(80) CHARACTER SET utf8 NOT NULL, + `incomingLimit` varchar(10) CHARACTER SET utf8 NOT NULL, + `pickupGroup` varchar(10) CHARACTER SET utf8 NOT NULL, + `careInvite` varchar(10) CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sipReg` +-- + +DROP TABLE IF EXISTS `sipReg`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sipReg` ( + `userId` int(10) unsigned NOT NULL, + `ipAddr` varchar(40) CHARACTER SET utf8 DEFAULT NULL, + `regSeconds` int(10) unsigned DEFAULT NULL, + `port` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `defaultUser` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `userAgent` varchar(80) CHARACTER SET utf8 DEFAULT NULL, + `lastMs` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `fullContact` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `regServer` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + PRIMARY KEY (`userId`), + CONSTRAINT `sipReg_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `sip` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SIP registrations'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'pbx' +-- + +-- +-- Dumping routines for database 'pbx' +-- +/*!50003 DROP FUNCTION IF EXISTS `clientFromPhone` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `clientFromPhone`(vPhone VARCHAR(255)) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vClient INT DEFAULT NULL; + + -- SET vPhone = vPhone COLLATE 'utf8_unicode_ci'; + + -- Searchs a customer associated to the phone number + + DROP TEMPORARY TABLE IF EXISTS tmp.customer; + CREATE TEMPORARY TABLE tmp.customer + ENGINE = MEMORY + SELECT id_cliente customer + FROM vn2008.Clientes c + WHERE telefono = vPhone + OR movil = vPhone + UNION + SELECT id_cliente + FROM vn2008.Consignatarios + WHERE telefono = vPhone + OR movil = vPhone + UNION + SELECT r.id_cliente + FROM vn2008.Relaciones r + JOIN vn2008.Contactos c ON r.Id_Contacto = c.Id_Contacto + WHERE c.telefono = vPhone + OR c.movil = vPhone; + + SELECT t.customer INTO vClient + FROM tmp.customer t + JOIN vn2008.Clientes c ON c.id_cliente = t.customer + WHERE c.activo + LIMIT 1; + + DROP TEMPORARY TABLE tmp.customer; + + RETURN vClient; +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 DROP FUNCTION IF EXISTS `phoneFormat` */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `phoneFormat`(vPhone VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 +BEGIN + DECLARE vI INT DEFAULT 0; + DECLARE vChr VARCHAR(1); + DECLARE vLen INT DEFAULT LENGTH(vPhone); + DECLARE vNewPhone VARCHAR(255) DEFAULT ''; + + WHILE vI < vLen + DO + SET vChr = SUBSTR(vPhone, vI + 1, 1); + + IF vChr REGEXP '^[0-9]$' + THEN + SET vNewPhone = CONCAT(vNewPhone, vChr); + ELSEIF vChr = '+' AND vI = 0 + THEN + SET vNewPhone = CONCAT(vNewPhone, '00'); + END IF; + + SET vI = vI + 1; + END WHILE; + + IF vNewPhone REGEXP '^0+$' OR vNewPhone = '' THEN + RETURN NULL; + END IF; + + IF vNewPhone REGEXP '^0034' THEN + SET vNewPhone = SUBSTR(vNewPhone, 5); + END IF; + + RETURN vNewPhone; +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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `extensionIsValid` */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `extensionIsValid`(vExtension VARCHAR(255)) + DETERMINISTIC +BEGIN + DECLARE vIsValid BOOLEAN; + + SET vIsValid = vExtension IS NULL + OR (vExtension REGEXP '^[0-9]{4}$' + AND MOD(vExtension, 100) != 0); + + IF NOT vIsValid + THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'EXTENSION_INVALID_FORMAT'; + 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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `phoneIsValid` */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `phoneIsValid`(vPhone VARCHAR(255)) +BEGIN + DECLARE vIsValid BOOLEAN; + + SET vIsValid = vPhone IS NULL + OR (vPhone REGEXP '^[0-9]+$' + AND vPhone NOT REGEXP '^0+$' + AND vPhone NOT REGEXP '^0034'); + + IF NOT vIsValid + THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'PHONE_INVALID_FORMAT'; + 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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `queueIsValid` */; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `queueIsValid`(vQueue VARCHAR(255)) + DETERMINISTIC +BEGIN + DECLARE vIsValid BOOLEAN; + + SET vIsValid = vQueue IS NULL + OR vQueue REGEXP '^[1-9][0-9]00$'; + + IF NOT vIsValid + THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'QUEUE_INVALID_FORMAT'; + 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 */ ; +ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- -- Current Database: `cache` @@ -58250,7 +62444,7 @@ CREATE TABLE `cache` ( `lifetime` time NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -58274,7 +62468,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=67662 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -58290,13 +62484,13 @@ CREATE TABLE `cache_valid` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `daily_task_log` +-- Table structure for table `dailyTaskLog` -- -DROP TABLE IF EXISTS `daily_task_log`; +DROP TABLE IF EXISTS `dailyTaskLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `daily_task_log` ( +CREATE TABLE `dailyTaskLog` ( `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno'; @@ -58455,6 +62649,53 @@ CREATE TABLE `weekly_sales` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Dumping events for database 'cache' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `barcodes_update` */; +DELIMITER ;; +ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ;; +/*!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 = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `barcodes_update` ON SCHEDULE EVERY 1 HOUR STARTS '2016-08-17 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL barcodes_update() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50106 DROP EVENT IF EXISTS `cacheCalcClean` */;; +DELIMITER ;; +ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `cacheCalcClean` ON SCHEDULE EVERY 30 MINUTE STARTS '2017-01-23 13:15:58' ON COMPLETION NOT PRESERVE ENABLE DO CALL cacheCalcClean() */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + -- -- Dumping routines for database 'cache' -- @@ -58511,8 +62752,8 @@ proc: BEGIN SELECT FechaInventario INTO v_date_inv FROM vn2008.tblContadores; - SELECT SUBTIME(NOW(), reserve_time) INTO v_reserve_date - FROM hedera.order_config; + SELECT SUBTIME(NOW(), reserveTime) INTO v_reserve_date + FROM hedera.orderConfig; -- Calcula el ultimo dia de vida para cada producto @@ -58701,8 +62942,8 @@ proc: BEGIN SELECT FechaInventario INTO v_date_inv FROM vn2008.tblContadores; - SELECT SUBTIME(NOW(), reserve_time) INTO v_reserve_date - FROM hedera.order_config; + SELECT SUBTIME(NOW(), reserveTime) INTO v_reserve_date + FROM hedera.orderConfig; -- Calcula el ultimo dia de vida para cada producto @@ -59231,11 +63472,11 @@ BEGIN SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); - INSERT INTO cache.daily_task_log(state) VALUES('clean START'); + INSERT INTO cache.dailyTaskLog(state) VALUES('clean START'); DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; - INSERT INTO cache.daily_task_log(state) VALUES('clean END'); + INSERT INTO cache.dailyTaskLog(state) VALUES('clean END'); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59252,7 +63493,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `departure_timing`() +CREATE DEFINER=`root`@`%` PROCEDURE `departure_timing`(vWarehouseId INT) BEGIN DECLARE done BOOL DEFAULT FALSE; @@ -59264,14 +63505,13 @@ DECLARE horasProd DECIMAL(5,2); DECLARE inicioProd DECIMAL(5,2) DEFAULT 24.00; DECLARE myTime DECIMAL(5,2); DECLARE departureLimit INT; -DECLARE myWarehouse INT; DECLARE myMinSpeed DECIMAL(10,2); - +DECLARE vLoadingDelay DECIMAL(5) DEFAULT 2; DECLARE rs CURSOR FOR SELECT Departure , Sum(pb.m3)/(GREATEST(v.m3,IFNULL(minSpeed,0))/1.3) AS Horas - , curDate()+(Departure-(Sum(pb.m3)/(GREATEST(v.m3,IFNULL(minSpeed,0))/1.3))/24) AS InicioPreparacion + , curDate()+(Departure + vLoadingDelay -(Sum(pb.m3)/(GREATEST(v.m3,IFNULL(minSpeed,0))/1.3))/24) AS InicioPreparacion FROM tmp.production_buffer pb JOIN vn2008.v_encajado_ultima_hora v ON v.warehouse_id = pb.warehouse_id LEFT JOIN cache.departure_limit dp ON dp.warehouse_id = pb.warehouse_id AND dp.fecha = CURDATE() @@ -59281,56 +63521,48 @@ DECLARE rs CURSOR FOR GROUP BY Departure ORDER BY Departure DESC; -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; -SET myTime = HOUR(now()) + MINUTE(now()) / 60; + SET myTime = HOUR(now()) + MINUTE(now()) / 60; -SELECT warehouse_id INTO myWarehouse -FROM tmp.production_buffer -LIMIT 1; + OPEN rs; -OPEN rs; + FETCH rs INTO rsDeparture, rsHoras , rsInicio; -FETCH rs INTO rsDeparture, rsHoras , rsInicio; + WHILE NOT done DO --- SELECT rsDeparture, rsHoras , rsInicio, myWarehouse; + SET resto = IF(inicioProd < rsDeparture, rsDeparture - inicioProd,0); + + SET inicioProd = rsDeparture - rsHoras; + + IF inicioProd - resto < myTime THEN + + SET done = TRUE; + + ELSE + + SET departureLimit = rsDeparture; + + FETCH rs INTO rsDeparture, rsHoras , rsInicio; + + -- SELECT rsDeparture, rsHoras , rsInicio; + + END IF; + + END WHILE; -WHILE NOT done DO + SET departureLimit = IFNULL(departureLimit,24); + SET departureLimit = IF(departureLimit = 0, 24, departureLimit); - SET resto = IF(inicioProd < rsDeparture, rsDeparture - inicioProd,0); - - SET inicioProd = rsDeparture - rsHoras; - - IF inicioProd - resto < myTime THEN - - SET done = TRUE; - - ELSE - - SET departureLimit = rsDeparture; - - FETCH rs INTO rsDeparture, rsHoras , rsInicio; - - -- SELECT rsDeparture, rsHoras , rsInicio; - - END IF; - -END WHILE; + SELECT minSpeed INTO myMinSpeed + FROM cache.departure_limit + WHERE warehouse_id = vWarehouseId + AND fecha = CURDATE(); -SET departureLimit = IFNULL(departureLimit,24); -SET departureLimit = IF(departureLimit = 0, 24, departureLimit); - - SELECT minSpeed INTO myMinSpeed - FROM cache.departure_limit - WHERE warehouse_id = myWarehouse - AND fecha = CURDATE(); - - REPLACE cache.departure_limit(warehouse_id, fecha, hora, minSpeed) - VALUES (myWarehouse, CURDATE(), IFNULL(departureLimit,24), IFNULL(myMinSpeed,0)); - - -CLOSE rs; + REPLACE cache.departure_limit(warehouse_id, fecha, hora, minSpeed) + VALUES (vWarehouseId, CURDATE(), IFNULL(departureLimit,24), IFNULL(myMinSpeed,0)); + CLOSE rs; END ;; DELIMITER ; @@ -59339,7 +63571,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `departure_timing_beta` */; -ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -59349,7 +63580,7 @@ ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `departure_timing_beta`() +CREATE DEFINER=`root`@`%` PROCEDURE `departure_timing_beta`(vWarehouseId INT) BEGIN DECLARE done BOOL DEFAULT FALSE; @@ -59361,7 +63592,6 @@ DECLARE horasProd DECIMAL(5,2); DECLARE inicioProd DECIMAL(5,2) DEFAULT 24.00; DECLARE myTime DECIMAL(5,2); DECLARE departureLimit INT; -DECLARE myWarehouse INT; DECLARE rs CURSOR FOR SELECT Departure @@ -59378,19 +63608,13 @@ DECLARE rs CURSOR FOR DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SET myTime = HOUR(now()) + MINUTE(now()) / 60; -SELECT warehouse_id INTO myWarehouse -FROM tmp.production_buffer -LIMIT 1; - OPEN rs; FETCH rs INTO rsDeparture, rsHoras , rsInicio; -SELECT rsDeparture, rsHoras , rsInicio, myWarehouse, done; +SELECT rsDeparture, rsHoras , rsInicio, vWarehouseId, done; WHILE NOT done DO @@ -59422,7 +63646,7 @@ SET departureLimit = IFNULL(departureLimit,24); IF departureLimit > 0 THEN REPLACE cache.departure_limit(warehouse_id, fecha, hora, minSpeed) - VALUES (myWarehouse, CURDATE(), departureLimit, myMinSpeed); + VALUES (vWarehouseId, CURDATE(), departureLimit, myMinSpeed); END IF; @@ -59435,7 +63659,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `departure_timing_kk` */; ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -59797,7 +64020,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `prod_graphic_refresh` */; -ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -59844,9 +64066,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `sales_refresh` */; -ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `sales_refreshkk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -59856,7 +64076,7 @@ ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `sales_refresh`() +CREATE DEFINER=`root`@`%` PROCEDURE `sales_refreshkk`() proc:BEGIN DECLARE v_calc INT; @@ -59940,7 +64160,6 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; /*!50003 DROP PROCEDURE IF EXISTS `stock_refresh` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60085,50 +64304,50 @@ ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET sql_mode = '' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `weekly_sales_refresh`(v_refresh BOOL) -BEGIN - DECLARE v_week_ini INT; - DECLARE v_week_end INT; - DECLARE v_date_ini DATE; - DECLARE v_date_end DATE; - DECLARE v_last_refresh DATE; - - IF GET_LOCK('weekly_sales', 300) - THEN - SELECT last_refresh INTO v_last_refresh FROM weekly_sales_info; - - IF v_last_refresh IS NULL THEN - SET v_refresh = TRUE; - END IF; - - IF v_refresh || v_last_refresh < CURDATE() - THEN - SET v_date_ini = TIMESTAMPADD(DAY, -(366 * 1.5), CURDATE()); - SET v_date_end = TIMESTAMPADD(DAY, -1, CURDATE()); - - IF v_refresh - THEN - TRUNCATE TABLE weekly_sales; - ELSE - SET v_week_ini = vn2008.to_weeks (v_date_ini); - SET v_date_ini = TIMESTAMPADD(DAY, -WEEKDAY(v_last_refresh) - 7, v_last_refresh); - SET v_week_end = vn2008.to_weeks (v_date_ini); - - DELETE FROM weekly_sales - WHERE week < v_week_ini OR week >= v_week_end; - END IF; - - CALL vn2008.weekly_sales_new (0, v_date_ini, v_date_end); - - INSERT INTO weekly_sales (item_id, week, warehouse_id, amount, price) - SELECT item_id, week, warehouse_id, amount, price FROM vn2008.weekly_sales; - - DROP TEMPORARY TABLE vn2008.weekly_sales; - - TRUNCATE TABLE weekly_sales_info; - INSERT INTO weekly_sales_info (last_refresh) VALUES (CURDATE()); - END IF; - - DO RELEASE_LOCK('weekly_sales'); +BEGIN + DECLARE v_week_ini INT; + DECLARE v_week_end INT; + DECLARE v_date_ini DATE; + DECLARE v_date_end DATE; + DECLARE v_last_refresh DATE; + + IF GET_LOCK('weekly_sales', 300) + THEN + SELECT last_refresh INTO v_last_refresh FROM weekly_sales_info; + + IF v_last_refresh IS NULL THEN + SET v_refresh = TRUE; + END IF; + + IF v_refresh || v_last_refresh < CURDATE() + THEN + SET v_date_ini = TIMESTAMPADD(DAY, -(366 * 1.5), CURDATE()); + SET v_date_end = TIMESTAMPADD(DAY, -1, CURDATE()); + + IF v_refresh + THEN + TRUNCATE TABLE weekly_sales; + ELSE + SET v_week_ini = vn2008.to_weeks (v_date_ini); + SET v_date_ini = TIMESTAMPADD(DAY, -WEEKDAY(v_last_refresh) - 7, v_last_refresh); + SET v_week_end = vn2008.to_weeks (v_date_ini); + + DELETE FROM weekly_sales + WHERE week < v_week_ini OR week >= v_week_end; + END IF; + + CALL vn2008.weekly_sales_new (0, v_date_ini, v_date_end); + + INSERT INTO weekly_sales (item_id, week, warehouse_id, amount, price) + SELECT item_id, week, warehouse_id, amount, price FROM vn2008.weekly_sales; + + DROP TEMPORARY TABLE vn2008.weekly_sales; + + TRUNCATE TABLE weekly_sales_info; + INSERT INTO weekly_sales_info (last_refresh) VALUES (CURDATE()); + END IF; + + DO RELEASE_LOCK('weekly_sales'); END IF; END ;; DELIMITER ; @@ -60139,617 +64358,657 @@ DELIMITER ; ALTER DATABASE `cache` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- --- Current Database: `pbx` +-- Current Database: `salix` -- -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `pbx` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `salix` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; -USE `pbx`; +USE `salix`; -- --- Table structure for table `blacklist` +-- Table structure for table `ACL` -- -DROP TABLE IF EXISTS `blacklist`; +DROP TABLE IF EXISTS `ACL`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `blacklist` ( - `phone` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`phone`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Hangup input calls from this list'; -/*!40101 SET character_set_client = @saved_cs_client */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`blacklistBeforeInsert` -BEFORE INSERT ON `blacklist` FOR EACH ROW -BEGIN - CALL phoneIsValid (NEW.phone); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`blacklistBerforeUpdate` -BEFORE UPDATE ON `blacklist` FOR EACH ROW -BEGIN - CALL phoneIsValid (NEW.phone); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; - --- --- Table structure for table `cdr` --- - -DROP TABLE IF EXISTS `cdr`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cdr` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `call_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `clid` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `src` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `dst` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `dcontext` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `dst_channel` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `last_app` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `last_data` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `duration` int(11) NOT NULL DEFAULT '0', - `billsec` int(11) NOT NULL DEFAULT '0', - `disposition` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `ama_flags` int(11) NOT NULL DEFAULT '0', - `account_code` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `unique_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `user_field` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - PRIMARY KEY (`id`), - KEY `calldate` (`call_date`), - KEY `dst` (`dst`), - KEY `accountcode` (`account_code`), - KEY `dstchannel` (`dst_channel`), - KEY `disposition` (`disposition`), - KEY `src` (`src`) -) ENGINE=MyISAM AUTO_INCREMENT=156174 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `cdrConf` --- - -DROP TABLE IF EXISTS `cdrConf`; -/*!50001 DROP VIEW IF EXISTS `cdrConf`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cdrConf` AS SELECT - 1 AS `calldate`, - 1 AS `clid`, - 1 AS `src`, - 1 AS `dst`, - 1 AS `dcontext`, - 1 AS `channel`, - 1 AS `dstchannel`, - 1 AS `lastapp`, - 1 AS `lastdata`, - 1 AS `duration`, - 1 AS `billsec`, - 1 AS `disposition`, - 1 AS `amaflags`, - 1 AS `accountcode`, - 1 AS `uniqueid`, - 1 AS `userfield`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `config` --- - -DROP TABLE IF EXISTS `config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `config` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `sundayFestive` tinyint(4) NOT NULL, - `countryPrefix` varchar(20) CHARACTER SET utf8 DEFAULT NULL, +CREATE TABLE `ACL` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `model` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `property` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `accessType` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `permission` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `principalType` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `principalId` varchar(512) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global configuration'; +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `followme` +-- Table structure for table `AccessToken` -- -DROP TABLE IF EXISTS `followme`; +DROP TABLE IF EXISTS `AccessToken`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `followme` ( - `extension` varchar(128) CHARACTER SET utf8 NOT NULL, - `phone` varchar(20) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`extension`), - CONSTRAINT `followme_ibfk_1` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`followmeBeforeInsert` -BEFORE INSERT ON `followme` FOR EACH ROW -BEGIN - CALL pbx.phoneIsValid (NEW.phone); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`followmeBeforeUpdate` -BEFORE UPDATE ON `followme` FOR EACH ROW -BEGIN - CALL pbx.phoneIsValid (NEW.phone); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; - --- --- Temporary view structure for view `followmeConf` --- - -DROP TABLE IF EXISTS `followmeConf`; -/*!50001 DROP VIEW IF EXISTS `followmeConf`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `followmeConf` AS SELECT - 1 AS `name`, - 1 AS `music`, - 1 AS `context`, - 1 AS `takecall`, - 1 AS `declinecall`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `followmeConfig` --- - -DROP TABLE IF EXISTS `followmeConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `followmeConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `music` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `context` varchar(50) CHARACTER SET utf8 NOT NULL, - `takeCall` char(1) CHARACTER SET utf8 NOT NULL, - `declineCall` char(1) CHARACTER SET utf8 NOT NULL, - `timeout` int(11) NOT NULL, +CREATE TABLE `AccessToken` ( + `id` varchar(255) CHARACTER SET utf8 NOT NULL, + `ttl` int(11) DEFAULT NULL, + `scopes` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `created` datetime DEFAULT NULL, + `userId` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `followmeNumberConf` +-- Temporary table structure for view `Account` -- -DROP TABLE IF EXISTS `followmeNumberConf`; -/*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/; +DROP TABLE IF EXISTS `Account`; +/*!50001 DROP VIEW IF EXISTS `Account`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `followmeNumberConf` AS SELECT - 1 AS `name`, - 1 AS `ordinal`, - 1 AS `phonenumber`, - 1 AS `timeout`*/; +/*!50001 CREATE TABLE `Account` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `password` tinyint NOT NULL, + `roleFk` tinyint NOT NULL, + `active` tinyint NOT NULL, + `email` tinyint NOT NULL, + `created` tinyint NOT NULL, + `updated` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `queue` +-- Temporary table structure for view `Accounting` -- -DROP TABLE IF EXISTS `queue`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `queue` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(128) CHARACTER SET utf8 NOT NULL, - `name` varchar(128) CHARACTER SET utf8 NOT NULL, - `config` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`), - UNIQUE KEY `description` (`description`), - KEY `config` (`config`), - CONSTRAINT `queue_ibfk_1` FOREIGN KEY (`config`) REFERENCES `queueConfig` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queues'; -/*!40101 SET character_set_client = @saved_cs_client */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queueBeforeInsert` -BEFORE INSERT ON `queue` FOR EACH ROW -BEGIN - CALL queueIsValid (NEW.name); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queueBeforeUpdate` -BEFORE UPDATE ON `queue` FOR EACH ROW -BEGIN - CALL queueIsValid (NEW.name); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; - --- --- Temporary view structure for view `queueConf` --- - -DROP TABLE IF EXISTS `queueConf`; -/*!50001 DROP VIEW IF EXISTS `queueConf`*/; +DROP TABLE IF EXISTS `Accounting`; +/*!50001 DROP VIEW IF EXISTS `Accounting`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `queueConf` AS SELECT - 1 AS `name`, - 1 AS `strategy`, - 1 AS `timeout`, - 1 AS `retry`, - 1 AS `weight`, - 1 AS `maxlen`, - 1 AS `ringinuse`*/; +/*!50001 CREATE TABLE `Accounting` ( + `id` tinyint NOT NULL, + `bank` tinyint NOT NULL, + `account` tinyint NOT NULL, + `accountingTypeFk` tinyint NOT NULL, + `entityFk` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `queueConfig` +-- Temporary table structure for view `Address` -- -DROP TABLE IF EXISTS `queueConfig`; +DROP TABLE IF EXISTS `Address`; +/*!50001 DROP VIEW IF EXISTS `Address`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Address` ( + `id` tinyint NOT NULL, + `consignee` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `postcode` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `phone` tinyint NOT NULL, + `mobile` tinyint NOT NULL, + `isEnabled` tinyint NOT NULL, + `isDefaultAddress` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `defaultAgencyFk` tinyint NOT NULL, + `longitude` tinyint NOT NULL, + `latitude` tinyint NOT NULL, + `isEqualizated` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Agency` +-- + +DROP TABLE IF EXISTS `Agency`; +/*!50001 DROP VIEW IF EXISTS `Agency`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Agency` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `isVolumetric` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `warehouseAliasFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `AgencyMode` +-- + +DROP TABLE IF EXISTS `AgencyMode`; +/*!50001 DROP VIEW IF EXISTS `AgencyMode`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `AgencyMode` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `description` tinyint NOT NULL, + `agencyTypeFk` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `inflation` tinyint NOT NULL, + `sendMailTo` tinyint NOT NULL, + `isForTicket` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Bank` +-- + +DROP TABLE IF EXISTS `Bank`; +/*!50001 DROP VIEW IF EXISTS `Bank`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Bank` ( + `id` tinyint NOT NULL, + `bank` tinyint NOT NULL, + `account` tinyint NOT NULL, + `cash` tinyint NOT NULL, + `entityFk` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `City` +-- + +DROP TABLE IF EXISTS `City`; +/*!50001 DROP VIEW IF EXISTS `City`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `City` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Client` +-- + +DROP TABLE IF EXISTS `Client`; +/*!50001 DROP VIEW IF EXISTS `Client`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Client` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `fi` tinyint NOT NULL, + `socialName` tinyint NOT NULL, + `contact` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `postcode` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `email` tinyint NOT NULL, + `phone` tinyint NOT NULL, + `mobile` tinyint NOT NULL, + `fax` tinyint NOT NULL, + `active` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `credit` tinyint NOT NULL, + `creditInsurance` tinyint NOT NULL, + `iban` tinyint NOT NULL, + `dueDay` tinyint NOT NULL, + `equalizationTax` tinyint NOT NULL, + `hasToInvoice` tinyint NOT NULL, + `invoiceByEmail` tinyint NOT NULL, + `payMethodFk` tinyint NOT NULL, + `salesPersonFk` tinyint NOT NULL, + `contactChannelFk` tinyint NOT NULL, + `sepaVnl` tinyint NOT NULL, + `coreVnl` tinyint NOT NULL, + `coreVnh` tinyint NOT NULL, + `eypbc` tinyint NOT NULL, + `quality` tinyint NOT NULL, + `vies` tinyint NOT NULL, + `isRelevant` tinyint NOT NULL, + `typeFk` tinyint NOT NULL, + `accountingAccount` tinyint NOT NULL, + `created` tinyint NOT NULL, + `hasToInvoiceByAddress` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ClientCredit` +-- + +DROP TABLE IF EXISTS `ClientCredit`; +/*!50001 DROP VIEW IF EXISTS `ClientCredit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ClientCredit` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `employeeFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ClientCreditLimit` +-- + +DROP TABLE IF EXISTS `ClientCreditLimit`; +/*!50001 DROP VIEW IF EXISTS `ClientCreditLimit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ClientCreditLimit` ( + `id` tinyint NOT NULL, + `maxAmount` tinyint NOT NULL, + `roleFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ClientObservation` +-- + +DROP TABLE IF EXISTS `ClientObservation`; +/*!50001 DROP VIEW IF EXISTS `ClientObservation`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ClientObservation` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `employeeFk` tinyint NOT NULL, + `text` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ClientType` +-- + +DROP TABLE IF EXISTS `ClientType`; +/*!50001 DROP VIEW IF EXISTS `ClientType`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ClientType` ( + `id` tinyint NOT NULL, + `code` tinyint NOT NULL, + `type` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ContactChannel` +-- + +DROP TABLE IF EXISTS `ContactChannel`; +/*!50001 DROP VIEW IF EXISTS `ContactChannel`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ContactChannel` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Country` +-- + +DROP TABLE IF EXISTS `Country`; +/*!50001 DROP VIEW IF EXISTS `Country`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Country` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `inCee` tinyint NOT NULL, + `code` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `realCountryFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `CreditClassification` +-- + +DROP TABLE IF EXISTS `CreditClassification`; +/*!50001 DROP VIEW IF EXISTS `CreditClassification`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `CreditClassification` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `started` tinyint NOT NULL, + `ended` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Delivery` +-- + +DROP TABLE IF EXISTS `Delivery`; +/*!50001 DROP VIEW IF EXISTS `Delivery`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Delivery` ( + `id` tinyint NOT NULL, + `date` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Employee` +-- + +DROP TABLE IF EXISTS `Employee`; +/*!50001 DROP VIEW IF EXISTS `Employee`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Employee` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `surname` tinyint NOT NULL, + `userFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `FakeProduction` +-- + +DROP TABLE IF EXISTS `FakeProduction`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `queueConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `strategy` varchar(128) CHARACTER SET utf8 NOT NULL, - `timeout` int(10) unsigned NOT NULL, - `retry` int(10) unsigned NOT NULL, - `weight` int(10) unsigned NOT NULL, - `maxLen` int(10) unsigned NOT NULL, - `ringInUse` tinyint(4) NOT NULL, +CREATE TABLE `FakeProduction` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL DEFAULT '0', + `clientFk` int(11) NOT NULL DEFAULT '0', + `client` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `date` date DEFAULT NULL, + `hour` time DEFAULT NULL, + `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `province` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `provinceFk` smallint(6) unsigned NOT NULL DEFAULT '0', + `agency` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `agencyFk` smallint(6) NOT NULL, + `lines` int(1) NOT NULL DEFAULT '0', + `m3` decimal(5,2) NOT NULL DEFAULT '0.00', + `problems` int(1) NOT NULL DEFAULT '0', + `problem` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `stateFk` bigint(4) NOT NULL DEFAULT '0', + `workerfk` int(11) NOT NULL DEFAULT '0', + `worker` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `salesPersonFk` int(11) NOT NULL DEFAULT '0', + `salesPerson` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `state` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `boxes` double DEFAULT NULL, + `routeFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for queues configuration'; +) ENGINE=InnoDB AUTO_INCREMENT=826 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `queueMember` +-- Temporary table structure for view `PayMethod` -- -DROP TABLE IF EXISTS `queueMember`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `queueMember` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `queue` varchar(128) CHARACTER SET utf8 NOT NULL, - `extension` varchar(128) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `queue` (`queue`,`extension`), - KEY `extension` (`extension`), - CONSTRAINT `queueMember_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `queueMember_ibfk_2` FOREIGN KEY (`extension`) REFERENCES `sip` (`extension`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue members'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `queueMemberConf` --- - -DROP TABLE IF EXISTS `queueMemberConf`; -/*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/; +DROP TABLE IF EXISTS `PayMethod`; +/*!50001 DROP VIEW IF EXISTS `PayMethod`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `queueMemberConf` AS SELECT - 1 AS `uniqueid`, - 1 AS `queue_name`, - 1 AS `interface`*/; +/*!50001 CREATE TABLE `PayMethod` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `graceDays` tinyint NOT NULL, + `outstandingDebt` tinyint NOT NULL, + `ibanRequired` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `queuePhone` +-- Temporary table structure for view `Province` -- -DROP TABLE IF EXISTS `queuePhone`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `queuePhone` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `queue` varchar(128) CHARACTER SET utf8 NOT NULL, - `phone` varchar(128) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `queue` (`queue`,`phone`), - CONSTRAINT `queuePhone_ibfk_1` FOREIGN KEY (`queue`) REFERENCES `queue` (`name`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queuePhoneBeforeInsert` -BEFORE INSERT ON `queuePhone` FOR EACH ROW -BEGIN - CALL phoneIsValid (NEW.phone); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`queuePhoneBeforeUpdate` -BEFORE UPDATE ON `queuePhone` FOR EACH ROW -BEGIN - CALL phoneIsValid (NEW.phone); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; - --- --- Table structure for table `schedule` --- - -DROP TABLE IF EXISTS `schedule`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `schedule` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `weekDay` tinyint(3) unsigned NOT NULL COMMENT '0 = Monday, 6 = Sunday', - `timeStart` time NOT NULL, - `timeEnd` time NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sip` --- - -DROP TABLE IF EXISTS `sip`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sip` ( - `user_id` int(10) unsigned NOT NULL DEFAULT '0', - `extension` varchar(128) CHARACTER SET utf8 NOT NULL, - `secret` varchar(80) CHARACTER SET utf8 NOT NULL, - `caller_id` varchar(80) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`user_id`), - UNIQUE KEY `extension` (`extension`), - CONSTRAINT `sip_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SIP accounts'; -/*!40101 SET character_set_client = @saved_cs_client */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`sipBeforeInsert` -BEFORE INSERT ON `sip` FOR EACH ROW -BEGIN - CALL extensionIsValid (NEW.extension); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `sipAfterInsert` -AFTER INSERT ON `sip` FOR EACH ROW -BEGIN - INSERT INTO sipReg (userId) VALUES (NEW.user_id); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `pbx`.`sipBeforeUpdate` -BEFORE UPDATE ON `sip` FOR EACH ROW -BEGIN - CALL extensionIsValid (NEW.extension); -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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; - --- --- Temporary view structure for view `sipConf` --- - -DROP TABLE IF EXISTS `sipConf`; -/*!50001 DROP VIEW IF EXISTS `sipConf`*/; +DROP TABLE IF EXISTS `Province`; +/*!50001 DROP VIEW IF EXISTS `Province`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `sipConf` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `secret`, - 1 AS `callerid`, - 1 AS `host`, - 1 AS `deny`, - 1 AS `permit`, - 1 AS `type`, - 1 AS `context`, - 1 AS `incominglimit`, - 1 AS `pickupgroup`, - 1 AS `careinvite`, - 1 AS `ipaddr`, - 1 AS `regseconds`, - 1 AS `port`, - 1 AS `defaultuser`, - 1 AS `useragent`, - 1 AS `lastms`, - 1 AS `fullcontact`, - 1 AS `regserver`*/; +/*!50001 CREATE TABLE `Province` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `countryFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `zoneFk` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `sipConfig` +-- Temporary table structure for view `Role` -- -DROP TABLE IF EXISTS `sipConfig`; +DROP TABLE IF EXISTS `Role`; +/*!50001 DROP VIEW IF EXISTS `Role`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Role` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `description` tinyint NOT NULL, + `created` tinyint NOT NULL, + `modified` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `RoleMapping` +-- + +DROP TABLE IF EXISTS `RoleMapping`; +/*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `RoleMapping` ( + `id` tinyint NOT NULL, + `principalType` tinyint NOT NULL, + `principalId` tinyint NOT NULL, + `roleId` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Route` +-- + +DROP TABLE IF EXISTS `Route`; +/*!50001 DROP VIEW IF EXISTS `Route`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Route` ( + `id` tinyint NOT NULL, + `date` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `State` +-- + +DROP TABLE IF EXISTS `State`; +/*!50001 DROP VIEW IF EXISTS `State`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `State` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `order` tinyint NOT NULL, + `alertLevel` tinyint NOT NULL, + `code` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Ticket` +-- + +DROP TABLE IF EXISTS `Ticket`; +/*!50001 DROP VIEW IF EXISTS `Ticket`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Ticket` ( + `id` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL, + `employeeFk` tinyint NOT NULL, + `date` tinyint NOT NULL, + `hour` tinyint NOT NULL, + `clientFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `TicketState` +-- + +DROP TABLE IF EXISTS `TicketState`; +/*!50001 DROP VIEW IF EXISTS `TicketState`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `TicketState` ( + `id` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `stateFk` tinyint NOT NULL, + `employeeFk` tinyint NOT NULL, + `updated` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Vehicle` +-- + +DROP TABLE IF EXISTS `Vehicle`; +/*!50001 DROP VIEW IF EXISTS `Vehicle`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Vehicle` ( + `id` tinyint NOT NULL, + `numberPlate` tinyint NOT NULL, + `tradeMark` tinyint NOT NULL, + `model` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `description` tinyint NOT NULL, + `m3` tinyint NOT NULL, + `isActive` tinyint NOT NULL +) ENGINE=MyISAM */; +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 TABLE `Warehouse` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `tpv` tinyint NOT NULL, + `inventory` tinyint NOT NULL, + `isManaged` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `WarehouseAlias` +-- + +DROP TABLE IF EXISTS `WarehouseAlias`; +/*!50001 DROP VIEW IF EXISTS `WarehouseAlias`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `WarehouseAlias` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Worker` +-- + +DROP TABLE IF EXISTS `Worker`; +/*!50001 DROP VIEW IF EXISTS `Worker`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Worker` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `surname` tinyint NOT NULL, + `userFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `Zone` +-- + +DROP TABLE IF EXISTS `Zone`; +/*!50001 DROP VIEW IF EXISTS `Zone`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `Zone` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `printingOrder` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sipConfig` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `host` varchar(40) CHARACTER SET utf8 DEFAULT NULL, - `deny` varchar(95) CHARACTER SET utf8 NOT NULL, - `permit` varchar(95) CHARACTER SET utf8 NOT NULL, - `type` enum('user','peer','friend') CHARACTER SET utf8 NOT NULL, - `context` varchar(80) CHARACTER SET utf8 NOT NULL, - `incomingLimit` varchar(10) CHARACTER SET utf8 NOT NULL, - `pickupGroup` varchar(10) CHARACTER SET utf8 NOT NULL, - `careInvite` varchar(10) CHARACTER SET utf8 NOT NULL, +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `realm` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `username` varchar(512) CHARACTER SET utf8 DEFAULT NULL, + `password` varchar(512) CHARACTER SET utf8 NOT NULL, + `email` varchar(512) CHARACTER SET utf8 NOT NULL, + `emailVerified` tinyint(1) DEFAULT NULL, + `verificationToken` varchar(512) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Default values for SIP accounts'; +) ENGINE=InnoDB AUTO_INCREMENT=50054 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `sipReg` +-- Dumping events for database 'salix' -- -DROP TABLE IF EXISTS `sipReg`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sipReg` ( - `userId` int(10) unsigned NOT NULL, - `ipAddr` varchar(40) CHARACTER SET utf8 DEFAULT NULL, - `regSeconds` int(10) unsigned DEFAULT NULL, - `port` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `defaultUser` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `userAgent` varchar(80) CHARACTER SET utf8 DEFAULT NULL, - `lastMs` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `fullContact` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `regServer` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - PRIMARY KEY (`userId`), - CONSTRAINT `sipReg_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `sip` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SIP registrations'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- --- Dumping routines for database 'pbx' +-- Dumping routines for database 'salix' -- -/*!50003 DROP FUNCTION IF EXISTS `clientFromPhone` */; +/*!50003 DROP PROCEDURE IF EXISTS `production_control_source` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -60759,51 +65018,144 @@ CREATE TABLE `sipReg` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `clientFromPhone`(vPhone VARCHAR(255)) RETURNS int(11) - DETERMINISTIC +CREATE DEFINER=`root`@`%` PROCEDURE `production_control_source`(idWarehouse INT, scopeDays TINYINT) BEGIN - DECLARE vClient INT DEFAULT NULL; + CALL vn2008.production_control_source(idWarehouse, scopeDays); - -- SET vPhone = vPhone COLLATE 'utf8_unicode_ci'; + SET @id = 0; - -- Searchs a customer associated to the phone number - - DROP TEMPORARY TABLE IF EXISTS tmp.customer; - CREATE TEMPORARY TABLE tmp.customer - ENGINE = MEMORY - SELECT id_cliente customer - FROM vn2008.Clientes c - WHERE telefono = vPhone - OR movil = vPhone - UNION - SELECT id_cliente - FROM vn2008.Consignatarios - WHERE telefono = vPhone - OR movil = vPhone - UNION - SELECT r.id_cliente - FROM vn2008.Relaciones r - JOIN vn2008.Contactos c ON r.Id_Contacto = c.Id_Contacto - WHERE c.telefono = vPhone - OR c.movil = vPhone; - - SELECT t.customer INTO vClient - FROM tmp.customer t - JOIN vn2008.Clientes c ON c.id_cliente = t.customer - WHERE c.activo - LIMIT 1; - - DROP TEMPORARY TABLE tmp.customer; - - RETURN vClient; + DROP TEMPORARY TABLE IF EXISTS tmp.production; + CREATE TEMPORARY TABLE tmp.production + ENGINE = MEMORY + SELECT + @id := @id+1 id, + p.Id_Ticket ticketFk, + p.Id_Cliente clientFk, + p.Alias client, + p.Fecha `date`, + p.Hora hour, + p.POBLACION city, + p.PROVINCIA province, + p.province_id provinceFk, + p.Agencia agency, + p.agency_id agencyFk, + p.lines, + p.m3, + p.problems, + p.problem, + p.state stateFk, + t.Id_Trabajador workerfk, + CONCAT(t.Nombre, ' ', t.Apellidos) worker, + tt.Id_Trabajador salesPersonFk, + CONCAT(tt.Nombre, ' ', tt.Apellidos) salesPerson, + s.name state, + p.Cajas boxes, + p.Id_Ruta routeFk + FROM tmp.production_buffer p + JOIN vn2008.state s ON p.state = s.id + JOIN vn2008.Trabajadores t ON p.CodigoTrabajador = t.CodigoTrabajador COLLATE utf8_unicode_ci + JOIN vn2008.Trabajadores tt ON p.Comercial = tt.CodigoTrabajador COLLATE utf8_unicode_ci; + + DROP TEMPORARY TABLE tmp.production_buffer; 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 DROP FUNCTION IF EXISTS `phoneFormat` */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; + +-- +-- Current Database: `vncontrol` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `vncontrol` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `vncontrol`; + +-- +-- Table structure for table `accion` +-- + +DROP TABLE IF EXISTS `accion`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accion` ( + `accion_id` int(11) NOT NULL AUTO_INCREMENT, + `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`accion_id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `clientes_match` +-- + +DROP TABLE IF EXISTS `clientes_match`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientes_match` ( + `Id_cliente` int(11) NOT NULL, + `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dailyTaskLog` +-- + +DROP TABLE IF EXISTS `dailyTaskLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `dailyTaskLog` ( + `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `fallo` +-- + +DROP TABLE IF EXISTS `fallo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fallo` ( + `queja_id` int(10) unsigned NOT NULL, + `accion_id` int(11) NOT NULL, + PRIMARY KEY (`queja_id`,`accion_id`), + KEY `accion` (`accion_id`,`queja_id`), + KEY `fallo` (`queja_id`), + CONSTRAINT `accion` FOREIGN KEY (`accion_id`) REFERENCES `accion` (`accion_id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `inter` +-- + +DROP TABLE IF EXISTS `inter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `inter` ( + `inter_id` int(11) NOT NULL AUTO_INCREMENT, + `state_id` tinyint(3) unsigned NOT NULL, + `fallo_id` int(10) unsigned NOT NULL DEFAULT '21', + `nota` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `Id_Ticket` int(11) DEFAULT NULL, + `Id_Trabajador` int(11) DEFAULT NULL, + `Id_Supervisor` int(11) DEFAULT NULL, + PRIMARY KEY (`inter_id`), + KEY `currante` (`Id_Trabajador`), + KEY `responsable` (`Id_Supervisor`), + KEY `ticket` (`Id_Ticket`), + KEY `inter_state` (`state_id`), + CONSTRAINT `currante` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, + CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn2008`.`state` (`id`) ON UPDATE CASCADE, + CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=8821795 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -60813,46 +65165,152 @@ ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `phoneFormat`(vPhone VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `interBeforeInsert` +BEFORE INSERT ON `inter` FOR EACH ROW BEGIN - DECLARE vI INT DEFAULT 0; - DECLARE vChr VARCHAR(1); - DECLARE vLen INT DEFAULT LENGTH(vPhone); - DECLARE vNewPhone VARCHAR(255) DEFAULT ''; - WHILE vI < vLen - DO - SET vChr = SUBSTR(vPhone, vI + 1, 1); + DECLARE contados INT; + DECLARE vSupervisor INT; - IF vChr REGEXP '^[0-9]$' - THEN - SET vNewPhone = CONCAT(vNewPhone, vChr); - ELSEIF vChr = '+' AND vI = 0 - THEN - SET vNewPhone = CONCAT(vNewPhone, '00'); + SELECT Id_Trabajador INTO vSupervisor FROM vn2008.Trabajadores WHERE user_id = account.userGetId(); + + SET NEW.Id_Supervisor = IFNULL(vSupervisor,20); + + IF NEW.state_id = 5 + THEN + SELECT count(Id_Ticket) INTO contados + FROM vncontrol.inter + WHERE state_id = 5 + AND Id_Ticket = NEW.Id_Ticket + AND IFNULL(Id_Supervisor,-1) <> vSupervisor + AND TIMESTAMPADD(SECOND, 60, odbc_date) >= NOW(); + + IF contados <> 0 THEN + CALL util.throw ('FALLO_AL_INSERTAR'); + END IF; + 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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterInsert` +AFTER INSERT ON `inter` FOR EACH ROW +BEGIN + REPLACE vn2008.Tickets_state(Id_Ticket, inter_id,state_name) + SELECT NEW.Id_Ticket, NEW.inter_id, s.`name` FROM vn2008.state s WHERE s.id = NEW.state_id; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterUpdate` +AFTER UPDATE ON `inter` FOR EACH ROW +BEGIN + DECLARE intIdTicket INT; + DECLARE intInterId INT; + DECLARE strName VARCHAR(15); + + IF (NEW.state_id <> OLD.state_id) THEN + REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name) + SELECT NEW.Id_Ticket, NEW.inter_id, s.`name` + FROM vn2008.state s WHERE s.id = NEW.state_id; + END IF; + IF (NEW.Id_Ticket <> OLD.Id_Ticket) THEN + + SELECT i.Id_Ticket, i.inter_id, s.`name` + INTO intIdTicket, intInterId, strName + FROM vncontrol.inter i + JOIN vn2008.state s ON i.state_id = s.id + WHERE Id_Ticket = NEW.Id_Ticket + ORDER BY odbc_date DESC + LIMIT 1; + IF intIdTicket > 0 THEN + REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name) + VALUES(intIdTicket, intInterId, strName); + END IF; + 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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterDelete` +AFTER DELETE ON `inter` FOR EACH ROW +BEGIN + DECLARE intIdTicket INT; + DECLARE intInterId INT; + DECLARE strName VARCHAR(15); + + DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' + BEGIN + DELETE FROM vn2008.Tickets_state + WHERE Id_Ticket = OLD.Id_Ticket; + END; + + IF OLD.odbc_date > TIMESTAMPADD(WEEK, -1, CURDATE()) THEN + + SELECT i.Id_Ticket, i.inter_id, s.`name` + INTO intIdTicket, intInterId, strName + FROM vncontrol.inter i + JOIN vn2008.state s ON i.state_id = s.id + WHERE Id_Ticket = OLD.Id_Ticket + ORDER BY odbc_date DESC + LIMIT 1; + + IF intIdTicket > 0 THEN + REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name) + VALUES (intIdTicket, intInterId, strName); END IF; - SET vI = vI + 1; - END WHILE; - - IF vNewPhone REGEXP '^0+$' OR vNewPhone = '' THEN - RETURN NULL; END IF; - IF vNewPhone REGEXP '^0034' THEN - SET vNewPhone = SUBSTR(vNewPhone, 5); - END IF; - - RETURN vNewPhone; -END ;; +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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `extensionIsValid` */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; + +-- +-- Dumping events for database 'vncontrol' +-- + +-- +-- Dumping routines for database 'vncontrol' +-- +/*!50003 DROP PROCEDURE IF EXISTS `clean` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -60862,29 +65320,24 @@ ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `extensionIsValid`(vExtension VARCHAR(255)) - DETERMINISTIC +CREATE DEFINER=`root`@`%` PROCEDURE `clean`() BEGIN - DECLARE vIsValid BOOLEAN; + + DECLARE v_date2 DATETIME DEFAULT TIMESTAMPADD(MONTH, -2,CURDATE()); - SET vIsValid = vExtension IS NULL - OR (vExtension REGEXP '^[0-9]{4}$' - AND MOD(vExtension, 100) != 0); + INSERT INTO vncontrol.dailyTaskLog(state) VALUES('clean START'); - IF NOT vIsValid - THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'EXTENSION_INVALID_FORMAT'; - END IF; + DELETE FROM vncontrol.inter WHERE odbc_date <= v_date2; + + INSERT INTO vncontrol.dailyTaskLog(state) VALUES('clean END'); + 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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `phoneIsValid` */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; +/*!50003 DROP PROCEDURE IF EXISTS `ResumenKK` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -60894,58 +65347,54 @@ ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `phoneIsValid`(vPhone VARCHAR(255)) +CREATE DEFINER=`root`@`%` PROCEDURE `ResumenKK`() BEGIN - DECLARE vIsValid BOOLEAN; - SET vIsValid = vPhone IS NULL - OR (vPhone REGEXP '^[0-9]+$' - AND vPhone NOT REGEXP '^0+$' - AND vPhone NOT REGEXP '^0034'); +select accion, CodigoTrabajador, semana, Pedidos, Lineas +from accion +join +( + SELECT * FROM + ( + select count(*) as Pedidos, semana, Id_Trabajador, accion_id + from + (select distinct * + from + ( + select vn2008.semana(odbc_date) as semana + ,Id_Trabajador + ,accion_id + ,Id_Ticket + from vncontrol.inter + ) sub + ) sub2 + group by semana, Id_Trabajador, accion_id + ) subpedidos + + inner join + ( + + select semana, Id_Trabajador, accion_id, count(*) as Lineas + from vn2008.Movimientos + inner join + ( + select distinct vn2008.semana(odbc_date) as semana, Id_Ticket, Id_Trabajador, accion_id from vncontrol.inter + ) vnc using(Id_Ticket) + group by semana, Id_Trabajador, accion_id + + ) sublineas using(semana, Id_Trabajador, accion_id) + +) sub3 using(accion_id) + +join vn2008.Trabajadores using(Id_Trabajador) +; - IF NOT vIsValid - THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'PHONE_INVALID_FORMAT'; - 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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -/*!50003 DROP PROCEDURE IF EXISTS `queueIsValid` */; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_general_ci ; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `queueIsValid`(vQueue VARCHAR(255)) - DETERMINISTIC -BEGIN - DECLARE vIsValid BOOLEAN; - - SET vIsValid = vQueue IS NULL - OR vQueue REGEXP '^[1-9][0-9]00$'; - - IF NOT vIsValid - THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'QUEUE_INVALID_FORMAT'; - 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 */ ; -ALTER DATABASE `pbx` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- -- Current Database: `hedera` @@ -60956,79 +65405,116 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `hedera` /*!40100 DEFAULT CHARACTER SET USE `hedera`; -- --- Temporary view structure for view `address_view` +-- Temporary table structure for view `address_view` -- DROP TABLE IF EXISTS `address_view`; /*!50001 DROP VIEW IF EXISTS `address_view`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `address_view` AS SELECT - 1 AS `id`, - 1 AS `customer_id`, - 1 AS `warehouse_id`, - 1 AS `name`, - 1 AS `city`, - 1 AS `province_id`, - 1 AS `zip_code`, - 1 AS `consignee`, - 1 AS `default`, - 1 AS `type_id`, - 1 AS `specs`, - 1 AS `insurance`, - 1 AS `postage`, - 1 AS `active`*/; +/*!50001 CREATE TABLE `address_view` ( + `id` tinyint NOT NULL, + `customer_id` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `city` tinyint NOT NULL, + `province_id` tinyint NOT NULL, + `zip_code` tinyint NOT NULL, + `consignee` tinyint NOT NULL, + `default` tinyint NOT NULL, + `type_id` tinyint NOT NULL, + `specs` tinyint NOT NULL, + `insurance` tinyint NOT NULL, + `postage` tinyint NOT NULL, + `active` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `basket` +-- Table structure for table `androidUser` +-- + +DROP TABLE IF EXISTS `androidUser`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `androidUser` ( + `androidId` varchar(200) CHARACTER SET utf8 NOT NULL, + `userFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`userFk`,`androidId`), + CONSTRAINT `androidUser_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `basket` -- DROP TABLE IF EXISTS `basket`; /*!50001 DROP VIEW IF EXISTS `basket`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `basket` AS SELECT - 1 AS `id`, - 1 AS `date_make`, - 1 AS `date_send`, - 1 AS `customer_id`, - 1 AS `delivery_method_id`, - 1 AS `agency_id`, - 1 AS `address_id`, - 1 AS `company_id`, - 1 AS `note`*/; +/*!50001 CREATE TABLE `basket` ( + `id` tinyint NOT NULL, + `date_make` tinyint NOT NULL, + `date_send` tinyint NOT NULL, + `customer_id` tinyint NOT NULL, + `delivery_method_id` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `address_id` tinyint NOT NULL, + `company_id` tinyint NOT NULL, + `note` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `basket_defaults` +-- Table structure for table `basketOrder` +-- + +DROP TABLE IF EXISTS `basketOrder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `basketOrder` ( + `clientFk` int(11) NOT NULL, + `orderFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`orderFk`,`clientFk`), + UNIQUE KEY `customer_id` (`clientFk`), + CONSTRAINT `basketOrder_ibfk_1` FOREIGN KEY (`orderFk`, `clientFk`) REFERENCES `order` (`id`, `customer_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `basketOrder_ibfk_2` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `basketOrder_ibfk_3` FOREIGN KEY (`clientFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `basket_defaults` -- DROP TABLE IF EXISTS `basket_defaults`; /*!50001 DROP VIEW IF EXISTS `basket_defaults`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `basket_defaults` AS SELECT - 1 AS `address_id`, - 1 AS `agency_id`, - 1 AS `delivery_method`*/; +/*!50001 CREATE TABLE `basket_defaults` ( + `address_id` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `delivery_method` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `basket_item` +-- Temporary table structure for view `basket_item` -- DROP TABLE IF EXISTS `basket_item`; /*!50001 DROP VIEW IF EXISTS `basket_item`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `basket_item` AS SELECT - 1 AS `id`, - 1 AS `order_id`, - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `price`*/; +/*!50001 CREATE TABLE `basket_item` ( + `id` tinyint NOT NULL, + `order_id` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `price` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -61054,9 +65540,9 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `default_lang` char(2) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The default language if none is specified', + `defaultLang` char(2) CHARACTER SET utf8 NOT NULL COMMENT 'The default language if none is specified', `https` tinyint(3) unsigned NOT NULL COMMENT 'Wether to force de use of HTTPS', - `cookie_life` smallint(5) unsigned NOT NULL COMMENT 'The cookies life, in days', + `cookieLife` smallint(5) unsigned NOT NULL COMMENT 'The cookies life, in days', `jwtKey` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The key used to encode/decode JWT tokens', `default_form` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Form loaded at web login', `restUri` varchar(255) COLLATE utf8_unicode_ci NOT NULL, @@ -61083,162 +65569,115 @@ CREATE TABLE `contact` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `recipient` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `customer_user` --- - -DROP TABLE IF EXISTS `customer_user`; -/*!50001 DROP VIEW IF EXISTS `customer_user`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `customer_user` AS SELECT - 1 AS `user_id`, - 1 AS `name`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `customer_view` +-- Temporary table structure for view `customer_view` -- DROP TABLE IF EXISTS `customer_view`; /*!50001 DROP VIEW IF EXISTS `customer_view`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `customer_view` AS SELECT - 1 AS `user_id`, - 1 AS `name`, - 1 AS `email`, - 1 AS `mail`, - 1 AS `default_address`, - 1 AS `credit`*/; +/*!50001 CREATE TABLE `customer_view` ( + `user_id` tinyint NOT NULL, + `name` tinyint NOT NULL, + `email` tinyint NOT NULL, + `mail` tinyint NOT NULL, + `default_address` tinyint NOT NULL, + `credit` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `form` +-- Table structure for table `imageCollection` -- -DROP TABLE IF EXISTS `form`; +DROP TABLE IF EXISTS `imageCollection`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `form` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `path` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `role_id` int(10) unsigned NOT NULL, - `parent` int(10) unsigned DEFAULT NULL, - `display_order` tinyint(4) unsigned NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - KEY `group_id` (`role_id`), - KEY `parent` (`parent`), - CONSTRAINT `form_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE, - CONSTRAINT `form_ibfk_2` FOREIGN KEY (`parent`) REFERENCES `form` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `gallery` --- - -DROP TABLE IF EXISTS `gallery`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `gallery` ( - `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `comment` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `image_config` --- - -DROP TABLE IF EXISTS `image_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `image_config` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', - `max_size` int(10) unsigned NOT NULL COMMENT 'Maximun size for uploaded images in MB', - `use_xsendfile` tinyint(4) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global image parameters'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `image_file` --- - -DROP TABLE IF EXISTS `image_file`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `image_file` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `schema_id` int(10) unsigned NOT NULL, - `file` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `stamp` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `schema_id_file` (`schema_id`,`file`), - CONSTRAINT `image_file_ibfk_1` FOREIGN KEY (`schema_id`) REFERENCES `image_schema` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `image_schema` --- - -DROP TABLE IF EXISTS `image_schema`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `image_schema` ( +CREATE TABLE `imageCollection` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `desc` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `max_width` int(10) unsigned NOT NULL, - `max_height` int(10) unsigned NOT NULL, + `maxWidth` int(10) unsigned NOT NULL, + `maxHeight` int(10) unsigned NOT NULL, `schema` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `table` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `column` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `image_schema_size` +-- Table structure for table `imageCollectionSize` -- -DROP TABLE IF EXISTS `image_schema_size`; +DROP TABLE IF EXISTS `imageCollectionSize`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `image_schema_size` ( +CREATE TABLE `imageCollectionSize` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `image_schema_id` int(10) unsigned NOT NULL, + `collectionFk` int(10) unsigned NOT NULL, `width` int(10) unsigned NOT NULL, `height` int(10) unsigned NOT NULL, `crop` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), - KEY `image_schema_id` (`image_schema_id`), - CONSTRAINT `image_schema_size_ibfk_1` FOREIGN KEY (`image_schema_id`) REFERENCES `image_schema` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `image_schema_id` (`collectionFk`), + CONSTRAINT `imageCollectionSize_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `invoice_view` +-- Table structure for table `imageConfig` +-- + +DROP TABLE IF EXISTS `imageConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `imageConfig` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', + `maxSize` int(10) unsigned NOT NULL COMMENT 'Maximun size for uploaded images in MB', + `useXsendfile` tinyint(4) NOT NULL COMMENT 'Whether to use the apache module XSendfile', + `url` varchar(255) NOT NULL COMMENT 'Public URL where image are hosted', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Global image parameters'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `imageFile` +-- + +DROP TABLE IF EXISTS `imageFile`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `imageFile` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `schemaFk` int(10) unsigned NOT NULL, + `file` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `stamp` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `schema_id_file` (`schemaFk`,`file`), + CONSTRAINT `imageFile_ibfk_1` FOREIGN KEY (`schemaFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=32793 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `invoice_view` -- DROP TABLE IF EXISTS `invoice_view`; /*!50001 DROP VIEW IF EXISTS `invoice_view`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoice_view` AS SELECT - 1 AS `invoice_id`, - 1 AS `serial_num`, - 1 AS `issued`, - 1 AS `amount`*/; +/*!50001 CREATE TABLE `invoice_view` ( + `invoice_id` tinyint NOT NULL, + `serial_num` tinyint NOT NULL, + `issued` tinyint NOT NULL, + `amount` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -61249,9 +65688,10 @@ DROP TABLE IF EXISTS `language`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `language` ( - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(10) CHARACTER SET utf8 NOT NULL, `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `active` tinyint(1) unsigned NOT NULL DEFAULT '0', + `orgName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `isActive` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`code`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -61270,7 +65710,7 @@ CREATE TABLE `link` ( `link` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `image` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61296,23 +65736,60 @@ CREATE TABLE `location` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `mail_config` +-- Table structure for table `mailConfig` -- -DROP TABLE IF EXISTS `mail_config`; +DROP TABLE IF EXISTS `mailConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mail_config` ( +CREATE TABLE `mailConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host', `port` smallint(6) NOT NULL DEFAULT '465' COMMENT 'SMTP port', `secure` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Wether to use a secure connection', `sender` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The sender mail address', - `sender_name` varchar(75) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The sender name', + `senderName` varchar(75) CHARACTER SET utf8 NOT NULL COMMENT 'The sender name', `user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP user', `password` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'SMTP password, base64 encoded', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `menu` +-- + +DROP TABLE IF EXISTS `menu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `menu` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `path` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `roleFk` int(10) unsigned NOT NULL, + `parentFk` int(10) unsigned DEFAULT NULL, + `displayOrder` tinyint(4) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + KEY `group_id` (`roleFk`), + KEY `parent` (`parentFk`), + CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `message` +-- + +DROP TABLE IF EXISTS `message`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `message` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `code` char(35) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61331,6 +65808,143 @@ CREATE TABLE `metatag` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `myAddress` +-- + +DROP TABLE IF EXISTS `myAddress`; +/*!50001 DROP VIEW IF EXISTS `myAddress`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myAddress` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `street` tinyint NOT NULL, + `city` tinyint NOT NULL, + `postalCode` tinyint NOT NULL, + `provinceFk` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `isDefaultAddress` tinyint NOT NULL, + `isActive` tinyint NOT NULL, + `longitude` tinyint NOT NULL, + `latitude` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `agencyFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `myClient` +-- + +DROP TABLE IF EXISTS `myClient`; +/*!50001 DROP VIEW IF EXISTS `myClient`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myClient` ( + `id` tinyint NOT NULL, + `isToBeMailed` tinyint NOT NULL, + `defaultAddressFk` tinyint NOT NULL, + `credit` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `myInvoice` +-- + +DROP TABLE IF EXISTS `myInvoice`; +/*!50001 DROP VIEW IF EXISTS `myInvoice`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myInvoice` ( + `id` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `issued` tinyint NOT NULL, + `amount` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `myMenu` +-- + +DROP TABLE IF EXISTS `myMenu`; +/*!50001 DROP VIEW IF EXISTS `myMenu`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myMenu` ( + `id` tinyint NOT NULL, + `path` tinyint NOT NULL, + `description` tinyint NOT NULL, + `parentFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `myTicket` +-- + +DROP TABLE IF EXISTS `myTicket`; +/*!50001 DROP VIEW IF EXISTS `myTicket`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myTicket` ( + `id` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `landed` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `agencyModeFk` tinyint NOT NULL, + `refFk` tinyint NOT NULL, + `addressFk` tinyint NOT NULL, + `location` tinyint NOT NULL, + `companyFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `myTicketRow` +-- + +DROP TABLE IF EXISTS `myTicketRow`; +/*!50001 DROP VIEW IF EXISTS `myTicketRow`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myTicketRow` ( + `id` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `price` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `reserved` tinyint NOT NULL, + `isPicked` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `myTpvTransaction` +-- + +DROP TABLE IF EXISTS `myTpvTransaction`; +/*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `myTpvTransaction` ( + `id` tinyint NOT NULL, + `merchantFk` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `receiptFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `response` tinyint NOT NULL, + `status` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `news` -- @@ -61343,26 +65957,28 @@ CREATE TABLE `news` ( `title` varchar(150) COLLATE utf8_unicode_ci NOT NULL, `text` text COLLATE utf8_unicode_ci NOT NULL, `image` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `user_id` int(10) unsigned NOT NULL, - `date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userFk` int(10) unsigned NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `priority` tinyint(3) unsigned NOT NULL DEFAULT '3', `tag` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'new', + `__date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Deprecated', + `__user_id` int(10) NOT NULL COMMENT 'Deprecated', PRIMARY KEY (`id`), - KEY `user` (`user_id`), + KEY `user` (`userFk`), KEY `tag` (`tag`), - CONSTRAINT `news_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, - CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `news_tag` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `news_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, + CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `newsTag` (`name`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=12993 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `news_tag` +-- Table structure for table `newsTag` -- -DROP TABLE IF EXISTS `news_tag`; +DROP TABLE IF EXISTS `newsTag`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `news_tag` ( +CREATE TABLE `newsTag` ( `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `description` varchar(25) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`name`) @@ -61383,7 +65999,7 @@ CREATE TABLE `order` ( `delivery_method_id` int(11) DEFAULT '3', `agency_id` int(11) DEFAULT '2', `address_id` int(11) DEFAULT NULL, - `company_id` smallint(5) unsigned DEFAULT '442', + `company_id` smallint(5) unsigned NOT NULL DEFAULT '442', `note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `source_app` set('WEB','ANDROID','IOS','TPV','TABLET_VN','') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'TPV', `is_bionic` tinyint(1) NOT NULL DEFAULT '1', @@ -61399,156 +66015,110 @@ CREATE TABLE `order` ( KEY `company_id` (`company_id`), KEY `id` (`id`,`customer_id`), KEY `source_app` (`source_app`), + KEY `confirmed` (`confirmed`), CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn2008`.`Consignatarios` (`id_consigna`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn2008`.`Vistas` (`vista_id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1242334 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `order_basket` +-- Table structure for table `orderCheck` -- -DROP TABLE IF EXISTS `order_basket`; +DROP TABLE IF EXISTS `orderCheck`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_basket` ( - `order_id` int(10) unsigned NOT NULL, - `customer_id` int(11) NOT NULL, - PRIMARY KEY (`order_id`,`customer_id`), - UNIQUE KEY `customer_id` (`customer_id`), - CONSTRAINT `order_basket_ibfk_1` FOREIGN KEY (`order_id`, `customer_id`) REFERENCES `order` (`id`, `customer_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `order_basket_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `order_basket_ibfk_3` FOREIGN KEY (`customer_id`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `order_check` --- - -DROP TABLE IF EXISTS `order_check`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_check` ( +CREATE TABLE `orderCheck` ( `id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT, - `max_time` time NOT NULL, - `deny_sunday` tinyint(1) unsigned NOT NULL, - `deny_day` date DEFAULT NULL, + `maxTime` time NOT NULL, + `denySunday` tinyint(1) NOT NULL, + `denyDay` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Conditions to check when an order is confirmed'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `order_check_festive` +-- Table structure for table `orderCheckFestive` -- -DROP TABLE IF EXISTS `order_check_festive`; +DROP TABLE IF EXISTS `orderCheckFestive`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_check_festive` ( +CREATE TABLE `orderCheckFestive` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `date` date NOT NULL, - `accept_orders` tinyint(1) unsigned NOT NULL DEFAULT '1', + `acceptOrders` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `date` (`date`) ) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `order_check_wday` +-- Table structure for table `orderCheckWday` -- -DROP TABLE IF EXISTS `order_check_wday`; +DROP TABLE IF EXISTS `orderCheckWday`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_check_wday` ( +CREATE TABLE `orderCheckWday` ( `weekday` tinyint(3) unsigned NOT NULL COMMENT '0 = Monday, 6 = Sunday', - `max_time` time NOT NULL, + `maxTime` time NOT NULL, PRIMARY KEY (`weekday`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `order_component` +-- Table structure for table `orderConfig` -- -DROP TABLE IF EXISTS `order_component`; +DROP TABLE IF EXISTS `orderConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_component` ( - `order_row_id` int(10) unsigned NOT NULL, - `component_id` int(11) NOT NULL, - `price` decimal(12,4) NOT NULL, - PRIMARY KEY (`order_row_id`,`component_id`), - KEY `component_id` (`component_id`), - CONSTRAINT `order_component_ibfk_1` FOREIGN KEY (`order_row_id`) REFERENCES `order_row` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `order_config` --- - -DROP TABLE IF EXISTS `order_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_config` ( +CREATE TABLE `orderConfig` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `employee_id` int(11) NOT NULL, - `delivery_agency` int(11) NOT NULL, - `guest_method` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `guest_agency` int(11) NOT NULL, - `reserve_time` time NOT NULL, + `employeeFk` int(11) NOT NULL, + `guestMethod` varchar(45) CHARACTER SET utf8 NOT NULL, + `guestAgencyFk` int(11) NOT NULL, + `reserveTime` time NOT NULL, + `defaultCompanyFk` smallint(6) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - KEY `employee_id` (`employee_id`), - KEY `delivery_agency` (`delivery_agency`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `employeeFk` (`employeeFk`), + KEY `guestAgencyFk` (`guestAgencyFk`), + KEY `defaultCompanyFk` (`defaultCompanyFk`), + KEY `guestMethod` (`guestMethod`), + CONSTRAINT `orderConfig_ibfk_1` FOREIGN KEY (`employeeFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, + CONSTRAINT `orderConfig_ibfk_2` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `vn2008`.`empresa` (`id`) ON UPDATE CASCADE, + CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `order_confirm_time` +-- Table structure for table `orderRow` -- -DROP TABLE IF EXISTS `order_confirm_time`; -/*!50001 DROP VIEW IF EXISTS `order_confirm_time`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_confirm_time` AS SELECT - 1 AS `date_make`, - 1 AS `source_app`, - 1 AS `customer_id`, - 1 AS `confirm_date`, - 1 AS `first_row_stamp`, - 1 AS `minutos`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `order_row` --- - -DROP TABLE IF EXISTS `order_row`; +DROP TABLE IF EXISTS `orderRow`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `order_row` ( +CREATE TABLE `orderRow` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `order_id` int(10) unsigned NOT NULL DEFAULT '0', - `item_id` int(11) NOT NULL DEFAULT '0', - `warehouse_id` int(11) DEFAULT NULL, + `orderFk` int(10) unsigned NOT NULL DEFAULT '0', + `itemFk` int(11) NOT NULL DEFAULT '0', + `warehouseFk` int(11) DEFAULT NULL, `shipment` date DEFAULT NULL, `amount` smallint(6) unsigned NOT NULL DEFAULT '0', - `price` decimal(12,2) DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, `rate` smallint(5) unsigned DEFAULT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `Id_Movimiento` int(11) DEFAULT NULL COMMENT 'Deprecated', + `saleFk` int(11) DEFAULT NULL COMMENT 'Deprecated', PRIMARY KEY (`id`), - KEY `item` (`item_id`), - KEY `order_id` (`order_id`), + KEY `item` (`itemFk`), + KEY `order_id` (`orderFk`), KEY `created` (`created`), - KEY `warehouse_shipment` (`warehouse_id`,`shipment`), - CONSTRAINT `order_row_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON UPDATE CASCADE, - CONSTRAINT `order_row_ibfk_3` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + KEY `warehouse_shipment` (`warehouseFk`,`shipment`), + CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON UPDATE CASCADE, + CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=7735016 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -61559,18 +66129,19 @@ CREATE TABLE `order_row` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `order_row_bi` BEFORE INSERT ON `order_row` -FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `orderRowBeforeInsert` + BEFORE INSERT ON `orderRow` + FOR EACH ROW BEGIN - DECLARE v_is_first BOOLEAN; + DECLARE vIsFirst BOOL; - SELECT (first_row_stamp IS NULL) INTO v_is_first + SELECT (first_row_stamp IS NULL) INTO vIsFirst FROM `order` - WHERE id = NEW.order_id; + WHERE id = NEW.orderFk; - IF v_is_first THEN + IF vIsFirst THEN UPDATE `order` SET first_row_stamp = NOW() - WHERE id = NEW.order_id; + WHERE id = NEW.orderFk; END IF; END */;; DELIMITER ; @@ -61580,40 +66151,128 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary view structure for view `order_row_view` +-- Table structure for table `orderRowComponent` +-- + +DROP TABLE IF EXISTS `orderRowComponent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orderRowComponent` ( + `rowFk` int(10) unsigned NOT NULL, + `componentFk` int(11) NOT NULL, + `price` decimal(12,4) NOT NULL, + PRIMARY KEY (`rowFk`,`componentFk`), + KEY `component_id` (`componentFk`), + CONSTRAINT `orderRowComponent_ibfk_1` FOREIGN KEY (`rowFk`) REFERENCES `orderRow` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `order_basket` +-- + +DROP TABLE IF EXISTS `order_basket`; +/*!50001 DROP VIEW IF EXISTS `order_basket`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `order_basket` ( + `customer_id` tinyint NOT NULL, + `order_id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `order_component` +-- + +DROP TABLE IF EXISTS `order_component`; +/*!50001 DROP VIEW IF EXISTS `order_component`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `order_component` ( + `order_row_id` tinyint NOT NULL, + `component_id` tinyint NOT NULL, + `price` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `order_confirm_time` +-- + +DROP TABLE IF EXISTS `order_confirm_time`; +/*!50001 DROP VIEW IF EXISTS `order_confirm_time`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `order_confirm_time` ( + `date_make` tinyint NOT NULL, + `source_app` tinyint NOT NULL, + `customer_id` tinyint NOT NULL, + `confirm_date` tinyint NOT NULL, + `first_row_stamp` tinyint NOT NULL, + `minutos` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `order_row` +-- + +DROP TABLE IF EXISTS `order_row`; +/*!50001 DROP VIEW IF EXISTS `order_row`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `order_row` ( + `id` tinyint NOT NULL, + `order_id` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `shipment` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `price` tinyint NOT NULL, + `rate` tinyint NOT NULL, + `created` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `order_row_view` -- DROP TABLE IF EXISTS `order_row_view`; /*!50001 DROP VIEW IF EXISTS `order_row_view`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_row_view` AS SELECT - 1 AS `id`, - 1 AS `order_id`, - 1 AS `warehouse_id`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `price2`*/; +/*!50001 CREATE TABLE `order_row_view` ( + `id` tinyint NOT NULL, + `order_id` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `item_id` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `price2` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- --- Temporary view structure for view `order_view` +-- Temporary table structure for view `order_view` -- DROP TABLE IF EXISTS `order_view`; /*!50001 DROP VIEW IF EXISTS `order_view`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `order_view` AS SELECT - 1 AS `id`, - 1 AS `date_make`, - 1 AS `date_send`, - 1 AS `customer_id`, - 1 AS `delivery_method_id`, - 1 AS `agency_id`, - 1 AS `note`, - 1 AS `address_id`, - 1 AS `company_id`*/; +/*!50001 CREATE TABLE `order_view` ( + `id` tinyint NOT NULL, + `date_make` tinyint NOT NULL, + `date_send` tinyint NOT NULL, + `customer_id` tinyint NOT NULL, + `delivery_method_id` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `note` tinyint NOT NULL, + `address_id` tinyint NOT NULL, + `company_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -61630,7 +66289,7 @@ CREATE TABLE `restPriv` ( PRIMARY KEY (`id`), KEY `role` (`role`), CONSTRAINT `restPriv_ibfk_1` FOREIGN KEY (`role`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61676,24 +66335,7 @@ CREATE TABLE `shelfConfig` ( CONSTRAINT `shelfConfig_ibfk_1` FOREIGN KEY (`family`) REFERENCES `vn2008`.`Tipos` (`tipo_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_2` FOREIGN KEY (`shelf`) REFERENCES `shelf` (`id`) ON UPDATE CASCADE, CONSTRAINT `shelfConfig_ibfk_3` FOREIGN KEY (`warehouse`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sms_config` --- - -DROP TABLE IF EXISTS `sms_config`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sms_config` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `uri` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `user` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61711,23 +66353,7 @@ CREATE TABLE `social` ( `priority` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `priority` (`priority`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sql_message` --- - -DROP TABLE IF EXISTS `sql_message`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sql_message` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `code` char(35) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `code` (`code`) -) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61741,129 +66367,76 @@ CREATE TABLE `survey` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `question` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `survey_answer` +-- Table structure for table `surveyAnswer` -- -DROP TABLE IF EXISTS `survey_answer`; +DROP TABLE IF EXISTS `surveyAnswer`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `survey_answer` ( +CREATE TABLE `surveyAnswer` ( `id` int(10) unsigned NOT NULL, - `survey_id` int(10) unsigned NOT NULL, + `surveyFk` int(10) unsigned NOT NULL, `answer` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `votes` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), - KEY `survey` (`survey_id`), - CONSTRAINT `survey_answer_ibfk_1` FOREIGN KEY (`survey_id`) REFERENCES `survey` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + KEY `survey` (`surveyFk`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `survey_vote` +-- Table structure for table `surveyVote` -- -DROP TABLE IF EXISTS `survey_vote`; +DROP TABLE IF EXISTS `surveyVote`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `survey_vote` ( - `survey_id` int(10) unsigned NOT NULL, - `user_id` int(10) unsigned NOT NULL, - PRIMARY KEY (`survey_id`,`user_id`), - KEY `user_id` (`user_id`), - CONSTRAINT `survey_vote_ibfk_1` FOREIGN KEY (`survey_id`) REFERENCES `survey` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `survey_vote_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +CREATE TABLE `surveyVote` ( + `surveyFk` int(10) unsigned NOT NULL, + `userFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`surveyFk`,`userFk`), + KEY `surveyVote_ibfk_2` (`userFk`), + CONSTRAINT `surveyVote_ibfk_1` FOREIGN KEY (`surveyFk`) REFERENCES `survey` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `surveyVote_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary view structure for view `ticket_row_view` +-- Table structure for table `tpvConfig` -- -DROP TABLE IF EXISTS `ticket_row_view`; -/*!50001 DROP VIEW IF EXISTS `ticket_row_view`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticket_row_view` AS SELECT - 1 AS `id`, - 1 AS `item_id`, - 1 AS `ticket_id`, - 1 AS `concept`, - 1 AS `amount`, - 1 AS `price`, - 1 AS `fixed`, - 1 AS `discount`, - 1 AS `cost`, - 1 AS `reserved`, - 1 AS `ok`*/; -SET character_set_client = @saved_cs_client; - --- --- Temporary view structure for view `ticket_view` --- - -DROP TABLE IF EXISTS `ticket_view`; -/*!50001 DROP VIEW IF EXISTS `ticket_view`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `ticket_view` AS SELECT - 1 AS `id`, - 1 AS `customer_id`, - 1 AS `warehouse_id`, - 1 AS `date`, - 1 AS `delivery`, - 1 AS `alias`, - 1 AS `agency_id`, - 1 AS `note`, - 1 AS `invoice`, - 1 AS `address_id`, - 1 AS `employee_id`, - 1 AS `comments`, - 1 AS `signed`, - 1 AS `packages`, - 1 AS `location`, - 1 AS `hour`, - 1 AS `blocked`, - 1 AS `solution`, - 1 AS `company_id`, - 1 AS `type`*/; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `tpv_config` --- - -DROP TABLE IF EXISTS `tpv_config`; +DROP TABLE IF EXISTS `tpvConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_config` ( +CREATE TABLE `tpvConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `currency` smallint(5) unsigned NOT NULL, `terminal` tinyint(3) unsigned NOT NULL, - `transaction_type` tinyint(3) unsigned NOT NULL, - `employee_id` int(10) NOT NULL, + `transactionType` tinyint(3) unsigned NOT NULL, + `maxAmount` int(10) unsigned DEFAULT NULL, + `employeeFk` int(10) NOT NULL, `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The bank web service URL for production environment', - `test_mode` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Whether test mode is enabled', - `test_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The bank web service URL for test environment', - `test_key` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The bank secret key for test environment', - `merchant_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `testMode` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Whether test mode is enabled', + `testUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The bank web service URL for test environment', + `testKey` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT 'The bank secret key for test environment', + `merchantUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`), - KEY `employee_id` (`employee_id`), - CONSTRAINT `employee_id` FOREIGN KEY (`employee_id`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV parameters'; + KEY `employee_id` (`employeeFk`), + CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV parameters'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tpv_error` +-- Table structure for table `tpvError` -- -DROP TABLE IF EXISTS `tpv_error`; +DROP TABLE IF EXISTS `tpvError`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_error` ( +CREATE TABLE `tpvError` ( `code` char(7) COLLATE utf8_unicode_ci NOT NULL, `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`code`) @@ -61871,70 +66444,68 @@ CREATE TABLE `tpv_error` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tpv_imap_config` +-- Table structure for table `tpvImapConfig` -- -DROP TABLE IF EXISTS `tpv_imap_config`; +DROP TABLE IF EXISTS `tpvImapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_imap_config` ( +CREATE TABLE `tpvImapConfig` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL, `user` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `pass` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `clean_period` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `success_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, - `error_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, + `cleanPeriod` varchar(15) CHARACTER SET utf8 NOT NULL, + `successFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, + `errorFolder` varchar(150) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tpv_merchant` +-- Table structure for table `tpvMerchant` -- -DROP TABLE IF EXISTS `tpv_merchant`; +DROP TABLE IF EXISTS `tpvMerchant`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_merchant` ( +CREATE TABLE `tpvMerchant` ( `id` int(10) unsigned NOT NULL COMMENT 'Merchant identifier', `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Small description', - `company_id` smallint(6) unsigned DEFAULT NULL COMMENT 'Company associated with the merchant', - `bank_id` int(10) NOT NULL COMMENT 'The bank where merchant receipts are created', - `secret_key` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The merchant secret key to sign transactions', + `companyFk` smallint(6) unsigned DEFAULT NULL COMMENT 'Company associated with the merchant', + `bankFk` int(10) NOT NULL COMMENT 'The bank where merchant receipts are created', + `secretKey` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The merchant secret key to sign transactions', PRIMARY KEY (`id`), - KEY `bank_id` (`bank_id`), - KEY `company_id` (`company_id`), - KEY `id` (`id`,`company_id`), - CONSTRAINT `company_id` FOREIGN KEY (`company_id`) REFERENCES `vn2008`.`empresa` (`id`) ON UPDATE CASCADE, - CONSTRAINT `tpv_merchant_ibfk_1` FOREIGN KEY (`bank_id`) REFERENCES `vn2008`.`Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV users and its associated company'; + KEY `bank_id` (`bankFk`), + KEY `company_id` (`companyFk`), + KEY `id` (`id`,`companyFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV providers'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tpv_merchant_enable` +-- Table structure for table `tpvMerchantEnable` -- -DROP TABLE IF EXISTS `tpv_merchant_enable`; +DROP TABLE IF EXISTS `tpvMerchantEnable`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_merchant_enable` ( - `merchant_id` int(10) unsigned NOT NULL DEFAULT '0', - `company_id` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`merchant_id`,`company_id`), - UNIQUE KEY `company_id` (`company_id`), - CONSTRAINT `tpv_merchant_enable_ibfk_1` FOREIGN KEY (`merchant_id`, `company_id`) REFERENCES `tpv_merchant` (`id`, `company_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV enabled users'; +CREATE TABLE `tpvMerchantEnable` ( + `merchantFk` int(10) unsigned NOT NULL DEFAULT '0', + `companyFk` smallint(6) unsigned NOT NULL, + PRIMARY KEY (`merchantFk`,`companyFk`), + UNIQUE KEY `company_id` (`companyFk`), + CONSTRAINT `tpvMerchantEnable_ibfk_1` FOREIGN KEY (`merchantFk`, `companyFk`) REFERENCES `tpvMerchant` (`id`, `companyFk`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Virtual TPV enabled providers'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tpv_response` +-- Table structure for table `tpvResponse` -- -DROP TABLE IF EXISTS `tpv_response`; +DROP TABLE IF EXISTS `tpvResponse`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_response` ( +CREATE TABLE `tpvResponse` ( `id` smallint(5) unsigned NOT NULL, `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) @@ -61942,53 +66513,34 @@ CREATE TABLE `tpv_response` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `tpv_transaction` +-- Table structure for table `tpvTransaction` -- -DROP TABLE IF EXISTS `tpv_transaction`; +DROP TABLE IF EXISTS `tpvTransaction`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tpv_transaction` ( +CREATE TABLE `tpvTransaction` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `merchant_id` int(10) unsigned NOT NULL, - `customer_id` int(11) NOT NULL, - `receipt_id` int(11) DEFAULT NULL, + `merchantFk` int(10) unsigned NOT NULL, + `clientFk` int(11) NOT NULL, + `receiptFk` int(11) DEFAULT NULL, `amount` int(10) unsigned NOT NULL, `response` smallint(5) unsigned DEFAULT NULL COMMENT 'Status notified by bank: NULL if no notification, 0 if success, error otherwise', - `error_code` char(7) COLLATE utf8_unicode_ci DEFAULT NULL, + `errorCode` char(7) COLLATE utf8_unicode_ci DEFAULT NULL, `status` enum('started','ok','ko') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'started', - `date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), - KEY `merchant_id` (`merchant_id`), - KEY `receipt_id` (`receipt_id`), - KEY `user_id` (`customer_id`), + KEY `merchant_id` (`merchantFk`), + KEY `receipt_id` (`receiptFk`), + KEY `user_id` (`clientFk`), KEY `response` (`response`), - KEY `error_code` (`error_code`), - CONSTRAINT `receipt_id` FOREIGN KEY (`receipt_id`) REFERENCES `vn2008`.`Recibos` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `tpv_transaction_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `tpv_transaction_ibfk_2` FOREIGN KEY (`merchant_id`) REFERENCES `tpv_merchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; + KEY `error_code` (`errorCode`), + CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn2008`.`Recibos` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tpvTransaction_ibfk_2` FOREIGN KEY (`merchantFk`) REFERENCES `tpvMerchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=187209 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary view structure for view `tpv_transaction_view` --- - -DROP TABLE IF EXISTS `tpv_transaction_view`; -/*!50001 DROP VIEW IF EXISTS `tpv_transaction_view`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `tpv_transaction_view` AS SELECT - 1 AS `id`, - 1 AS `merchant_id`, - 1 AS `customer_id`, - 1 AS `receipt_id`, - 1 AS `amount`, - 1 AS `response`, - 1 AS `status`, - 1 AS `date_time`*/; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `userSession` -- @@ -62009,31 +66561,17 @@ CREATE TABLE `userSession` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `user_android` +-- Temporary table structure for view `user_android` -- DROP TABLE IF EXISTS `user_android`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `user_android` ( - `user_id` int(10) unsigned NOT NULL, - `android_id` varchar(200) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`user_id`,`android_id`), - CONSTRAINT `user_android_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary view structure for view `user_android_view` --- - -DROP TABLE IF EXISTS `user_android_view`; -/*!50001 DROP VIEW IF EXISTS `user_android_view`*/; +/*!50001 DROP VIEW IF EXISTS `user_android`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `user_android_view` AS SELECT - 1 AS `user_id`, - 1 AS `android_id`*/; +/*!50001 CREATE TABLE `user_android` ( + `android_id` tinyint NOT NULL, + `user_id` tinyint NOT NULL +) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; -- @@ -62049,7 +66587,7 @@ CREATE TABLE `visit` ( PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgent`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgent`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1147304 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62069,7 +66607,7 @@ CREATE TABLE `visitAccess` ( KEY `visit_access_idx_agent` (`agent`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agent`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2440628 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62094,7 +66632,7 @@ CREATE TABLE `visitAgent` ( KEY `firstAccess` (`firstAccess`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visit`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccess`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1666846 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62114,9 +66652,13 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`user`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`access`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2372523 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Dumping events for database 'hedera' +-- + -- -- Dumping routines for database 'hedera' -- @@ -62145,67 +66687,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `customer_get_debt` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `customer_get_debt`() RETURNS double -BEGIN - DECLARE v_debt DOUBLE; - - CALL customer_get_debt_by_company (); - - SELECT SUM(amount) INTO v_debt - FROM t_customer_debt; - - DROP TEMPORARY TABLE t_customer_debt; - - RETURN v_debt; -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 DROP FUNCTION IF EXISTS `invoice_get_path` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `invoice_get_path`(v_invoice INT) RETURNS varchar(255) CHARSET utf8 -BEGIN - DECLARE v_issued DATE; - DECLARE v_serial VARCHAR(15); - - SELECT Fecha, Id_Factura - INTO v_issued, v_serial - FROM vn2008.Facturas WHERE factura_id = v_invoice; - - RETURN CONCAT_WS('/' - ,'invoice' - ,YEAR(v_issued) - ,MONTH(v_issued) - ,DAY(v_issued) - ,CONCAT(YEAR(v_issued), v_serial, '.pdf') - ); -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 DROP FUNCTION IF EXISTS `orderRowCheckAmount` */; +/*!50003 DROP FUNCTION IF EXISTS `invoiceGetPath` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -62215,31 +66697,83 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `orderRowCheckAmount`(vOrder INT, vItem INT, vAmount INT) RETURNS int(11) +CREATE DEFINER=`root`@`%` FUNCTION `invoiceGetPath`(vInvoice INT) RETURNS varchar(255) CHARSET utf8 BEGIN - DECLARE vGroup INT; - DECLARE vMod INT; - DECLARE vIsBionic BOOLEAN; + DECLARE vIssued DATE; + DECLARE vSerial VARCHAR(15); - SELECT CASE caja WHEN 0 THEN 1 WHEN 2 THEN packing ELSE grouping END, o.is_bionic - INTO vGroup, vIsBionic - FROM `order` o - JOIN vn2008.v_compres c ON c.warehouse_id = o.wh_id - WHERE Id_Article = vItem AND o.id = vOrder AND c.landing <= o.date_send - ORDER BY landing DESC LIMIT 1; + SELECT issued, ref + INTO vIssued, vSerial + FROM vn.invoiceOut WHERE id = vInvoice; - IF !vIsBionic - THEN - SET vMod = MOD(vAmount, vGroup); + RETURN CONCAT_WS('/' + ,'invoice' + ,YEAR(vIssued) + ,MONTH(vIssued) + ,DAY(vIssued) + ,CONCAT(YEAR(vIssued), vSerial, '.pdf') + ); +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 DROP FUNCTION IF EXISTS `myClientGetDebt` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `myClientGetDebt`(vDate DATE) RETURNS decimal(10,2) +BEGIN +/** + * Calcula el saldo del cliente actual. + * + * @return Saldo del cliente + */ + RETURN vn.clientGetDebt(account.userGetId(), vDate); +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 DROP FUNCTION IF EXISTS `orderGetTotal` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `orderGetTotal`(vOrder INT) RETURNS decimal(10,2) + READS SQL DATA + DETERMINISTIC +BEGIN +/** + * Obtiene el total de un pedido con el IVA y el recargo de + * equivalencia incluidos. + * + * @param vOrder El identificador del pedido + * @return El total del pedido + */ + DECLARE vTotal DECIMAL(10,2); - IF vMod - THEN - SET vAmount = vAmount + vGroup - vMod; - -- CALL util.warn ('ORDER_AMOUNT_ROUNDED'); - END IF; - END IF; + CALL orderGetTax (vOrder); - RETURN vAmount; + SELECT SUM(taxBase) + SUM(tax) + SUM(equalizationTax) INTO vTotal + FROM tmp.orderTax; + + DROP TEMPORARY TABLE tmp.orderTax; + + RETURN vTotal; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -62254,29 +66788,22 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `order_get_total`(v_order INT) RETURNS double +CREATE DEFINER=`root`@`%` FUNCTION `order_get_total`(vOrder INT) RETURNS decimal(10,2) + READS SQL DATA + DETERMINISTIC BEGIN /** * Obtiene el total de un pedido con el IVA y el recargo de * equivalencia incluidos. * - * @param v_order El identificador del pedido + * @deprecated Use function orderGetTotal() instead * + * @param vOrder El identificador del pedido * @return El total del pedido - **/ - - DECLARE v_total DOUBLE; - - CALL order_get_vat (v_order); - - SELECT SUM(tax_base) + SUM(vat) + SUM(surcharge) INTO v_total - FROM t_order_vat; - - DROP TEMPORARY TABLE t_order_vat; - - RETURN v_total; + */ + RETURN orderGetTotal (vOrder); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -62316,120 +66843,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `agency_list_from_date` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `agency_list_from_date`(v_date DATE, v_address INT) -BEGIN -/** - * Devuelve el listado de agencias disponibles para la fecha - * y dirección pasadas. - * - * @param v_date Fecha de recogida - * @address v_addres Id de dirección de envío, @NULL si es recogida - **/ - DECLARE v_agency INT; - DECLARE v_done BOOLEAN; - - DECLARE cur CURSOR FOR - SELECT agency_id FROM vn2008.agency; - -- WHERE IFNULL(warehouse_alias_id, 1) <> 28; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS t_agency; - CREATE TEMPORARY TABLE t_agency - ( - agency_id INT, - PRIMARY KEY (agency_id) - ) - ENGINE = MEMORY; - - OPEN cur; - - l: LOOP - SET v_done = FALSE; - FETCH cur INTO v_agency; - - IF v_done THEN - LEAVE l; - END IF; - - CALL vn2008.travel_tree (v_date, v_address, v_agency); - - -- No puedo usar IGNORE porque lanza un error 'invisible' - - INSERT /* IGNORE */ INTO t_agency - SELECT a.Id_Agencia - FROM vn2008.Agencias a - JOIN vn2008.travel_tree t - JOIN vn2008.warehouse w on w.id = t.warehouse_id - WHERE a.agency_id = v_agency - ON DUPLICATE KEY UPDATE - agency_id = VALUES(agency_id); - END LOOP; -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 DROP PROCEDURE IF EXISTS `basket_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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `basket_check`() -BEGIN -/** - * Comprueba que la cesta esta creada y que su configuración es - * correcta. Si la configuración es correcta pero lleva mucho - * tiempo creada actualiza los precios y cantidades de los artículos. - * - * @select El id del pedido y el estado de la cesta - **/ - DECLARE v_order INT; - DECLARE v_created DATETIME; - DECLARE v_status VARCHAR(15) DEFAULT 'OK'; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_status = 'NOT_EXISTS'; - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET v_status = 'BAD_CONFIG'; - - SELECT id, date_make - INTO v_order, v_created - FROM basket; - - IF v_status = 'OK' - THEN - CALL order_check_config (v_order); - - IF v_status = 'OK' AND v_created < TIMESTAMPADD(DAY, -1, NOW()) - THEN - CALL order_update (v_order); - SET v_status = 'UPDATED'; - END IF; - END IF; - - SELECT v_status stat; -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 DROP PROCEDURE IF EXISTS `basket_configure` */; +/*!50003 DROP PROCEDURE IF EXISTS `basketAddItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -62439,207 +66853,30 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `basket_configure`( - v_delivery DATE, - v_delivery_method VARCHAR(45), - v_agency INT, - v_address INT) +CREATE DEFINER=`root`@`%` PROCEDURE `basketAddItem`( + vWarehouse INT, + vItem INT, + vAmount INT) BEGIN -/** - * Configura la cesta de la compra utilizando los parámetros - * pasados. Si los parámetros no son válidos devuelve un error. - * - * @param v_delivery Fecha de recogida - * @param v_agency Id de la agencia - * @param v_address Id de dirección de envío, @NULL si es recogida - **/ - DECLARE v_order INT; - DECLARE v_company INT; - DECLARE v_delivery_method_id INT; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_order = NULL; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - SELECT vista_id INTO v_delivery_method_id - FROM vn2008.Vistas - WHERE code = v_delivery_method; - - IF v_delivery_method = 'DELIVERY' - THEN - SELECT delivery_agency INTO v_agency - FROM order_config; - END IF; - - IF v_delivery_method = 'PICKUP' AND v_address IS NULL - THEN - SELECT default_address INTO v_address - FROM customer_view; - END IF; - - SET v_order = basketGetId(); - - IF v_order IS NULL - THEN - SELECT empresa_id INTO v_company - FROM vn2008.Clientes_empresa - WHERE Id_Cliente = account.userGetId() - AND CURDATE() BETWEEN fecha_ini AND fecha_fin - LIMIT 1; - - INSERT INTO `order` - SET - customer_id = account.userGetId(), - date_send = v_delivery, - delivery_method_id = v_delivery_method_id, - agency_id = v_agency, - address_id = v_address, - source_app = 'WEB', - company_id = IFNULL(v_company, 442); - - SET v_order = LAST_INSERT_ID(); - - INSERT INTO order_basket SET - customer_id = account.userGetId(), - order_id = v_order; - ELSE - UPDATE `order` - SET - date_send = v_delivery, - delivery_method_id = v_delivery_method_id, - agency_id = v_agency, - address_id = v_address - WHERE - id = v_order; - - CALL order_update (v_order); - END IF; - - CALL order_check_config (v_order); - - COMMIT; -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 DROP PROCEDURE IF EXISTS `basket_configure_for_guest` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `basket_configure_for_guest`() -BEGIN - DECLARE v_method VARCHAR(45); - DECLARE v_agency INT; - - SELECT guest_method, guest_agency - INTO v_method, v_agency - FROM order_config - LIMIT 1; - - CALL basket_configure (CURDATE(), v_method, v_agency, 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 DROP PROCEDURE IF EXISTS `basket_confirm` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `basket_confirm`() -BEGIN - DECLARE v_order INT DEFAULT basketGetId (); - - IF v_order IS NOT NULL - THEN - CALL order_confirm_bionic (v_order); - - DELETE FROM order_basket - WHERE order_id = v_order; - 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 DROP PROCEDURE IF EXISTS `basket_get_vat` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `basket_get_vat`() -BEGIN - CALL order_get_vat (basketGetId()); -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 DROP PROCEDURE IF EXISTS `basket_item_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `basket_item_add`( - v_warehouse INT, - v_item INT, - v_amount INT) -BEGIN - DECLARE v_calc INT; - DECLARE v_order INT; - DECLARE v_type INT; - DECLARE v_row INT; - DECLARE v_add INT; - DECLARE v_available INT; - DECLARE v_done BOOLEAN; - DECLARE v_grouping INT; - DECLARE v_rate INT; - DECLARE v_shipment DATE; - DECLARE v_price DECIMAL(10,2); + DECLARE vOrder INT; + DECLARE vRow INT; + DECLARE vAdd INT; + DECLARE vAvailable INT; + DECLARE vDone BOOL; + DECLARE vGrouping INT; + DECLARE vRate INT; + DECLARE vShipment DATE; + DECLARE vPrice DECIMAL(10,2); DECLARE cur CURSOR FOR SELECT grouping, price, rate FROM tmp.bionic_price - WHERE warehouse_id = v_warehouse - AND item_id = v_item + WHERE warehouse_id = vWarehouse + AND item_id = vItem ORDER BY grouping DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; + SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -62647,22 +66884,22 @@ BEGIN RESIGNAL; END; - CALL bionic_from_item (v_item); + CALL bionic_from_item (vItem); START TRANSACTION; - SET v_order = basketGetId(); + SET vOrder = basketGetId(); - SELECT Fecha_envio INTO v_shipment + SELECT Fecha_envio INTO vShipment FROM tmp.travel_tree - WHERE warehouse_id = v_warehouse; + WHERE warehouse_id = vWarehouse; - SELECT available INTO v_available + SELECT available INTO vAvailable FROM tmp.bionic_lot - WHERE warehouse_id = v_warehouse - AND item_id = v_item; + WHERE warehouse_id = vWarehouse + AND item_id = vItem; - IF v_amount > v_available + IF vAmount > vAvailable THEN CALL util.throw ('ORDER_ROW_UNAVAILABLE'); END IF; @@ -62670,39 +66907,39 @@ BEGIN OPEN cur; l: LOOP - SET v_done = FALSE; - FETCH cur INTO v_grouping, v_price, v_rate; + SET vDone = FALSE; + FETCH cur INTO vGrouping, vPrice, vRate; - IF v_done THEN + IF vDone THEN LEAVE l; END IF; - SET v_add = v_amount - MOD(v_amount, v_grouping); - SET v_amount = v_amount - v_add; + SET vAdd = vAmount - MOD(vAmount, vGrouping); + SET vAmount = vAmount - vAdd; - IF v_add = 0 THEN + IF vAdd = 0 THEN ITERATE l; END IF; INSERT INTO order_row SET - order_id = v_order, - item_id = v_item, - warehouse_id = v_warehouse, - shipment = v_shipment, - rate = v_rate, - amount = v_add, - price = v_price; + order_id = vOrder, + item_id = vItem, + warehouse_id = vWarehouse, + shipment = vShipment, + rate = vRate, + amount = vAdd, + price = vPrice; - SET v_row = LAST_INSERT_ID(); + SET vRow = LAST_INSERT_ID(); INSERT INTO order_component (order_row_id, component_id, price) - SELECT v_row, c.component_id, c.cost + SELECT vRow, c.component_id, c.cost FROM tmp.bionic_component c JOIN bi.tarifa_componentes t ON t.Id_Componente = c.component_id - AND (t.tarifa_class IS NULL OR t.tarifa_class = v_rate) - WHERE c.warehouse_id = v_warehouse - AND c.item_id = v_item; + AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate) + WHERE c.warehouse_id = vWarehouse + AND c.item_id = vItem; END LOOP; CLOSE cur; @@ -62715,6 +66952,233 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `basketCheck` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `basketCheck`() +BEGIN +/** + * Comprueba que la cesta esta creada y que su configuración es + * correcta. Si la configuración es correcta pero lleva mucho + * tiempo creada actualiza los precios y cantidades de los artículos. + * + * @select El id del pedido y el estado de la cesta + */ + DECLARE vOrder INT; + DECLARE vCreated DATETIME; + DECLARE vStatus VARCHAR(15) DEFAULT 'OK'; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vStatus = 'NOT_EXISTS'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET vStatus = 'BAD_CONFIG'; + + SELECT id, date_make + INTO vOrder, vCreated + FROM basket; + + IF vStatus = 'OK' + THEN + CALL orderCheckConfig (vOrder); + + IF vStatus = 'OK' AND vCreated < TIMESTAMPADD(DAY, -1, NOW()) + THEN + CALL orderUpdate (vOrder); + SET vStatus = 'UPDATED'; + END IF; + END IF; + + SELECT vStatus stat; +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 DROP PROCEDURE IF EXISTS `basketConfigure` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `basketConfigure`( + vDelivery DATE, + vDeliveryMethod VARCHAR(45), + vAgency INT, + vAddress INT) +BEGIN +/** + * Configura la cesta de la compra utilizando los parámetros + * pasados. Si los parámetros no son válidos devuelve un error. + * + * @param vDelivery Fecha de recogida + * @param vAgency Id de la agencia + * @param vAddress Id de dirección de envío, @NULL si es recogida + */ + DECLARE vOrder INT; + DECLARE vCompany INT; + DECLARE vDeliveryMethodId INT; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vOrder = NULL; + DECLARE EXIT HANDLER FOR SQLSTATE '45000' + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + SELECT id INTO vDeliveryMethodId + FROM vn.deliveryMethod + WHERE code = vDeliveryMethod; + + IF vDeliveryMethod = 'PICKUP' AND vAddress IS NULL + THEN + SELECT defaultAddressFk INTO vAddress + FROM myClient; + END IF; + + SET vOrder = basketGetId(); + + IF vOrder IS NULL + THEN + SELECT companyFk INTO vCompany + FROM vn.clientDefaultCompany + WHERE ClientFk = account.userGetId() + AND CURDATE() BETWEEN started AND finished + LIMIT 1; + + IF vCompany IS NULL + THEN + SELECT defaultCompanyFk INTO vCompany + FROM orderConfig; + END IF; + + INSERT INTO `order` + SET + customer_id = account.userGetId(), + date_send = vDelivery, + delivery_method_id = vDeliveryMethodId, + agency_id = vAgency, + address_id = vAddress, + source_app = 'WEB', + company_id = vCompany; + + SET vOrder = LAST_INSERT_ID(); + + INSERT INTO basketOrder SET + clientFk = account.userGetId(), + orderFk = vOrder; + ELSE + UPDATE `order` + SET + date_send = vDelivery, + delivery_method_id = vDeliveryMethodId, + agency_id = vAgency, + address_id = vAddress + WHERE + id = vOrder; + + CALL orderUpdate (vOrder); + END IF; + + CALL orderCheckConfig (vOrder); + + COMMIT; +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 DROP PROCEDURE IF EXISTS `basketConfigureForGuest` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `basketConfigureForGuest`() +BEGIN + DECLARE vMethod VARCHAR(45); + DECLARE vAgency INT; + + SELECT guestMethod, guestAgencyFk + INTO vMethod, vAgency + FROM orderConfig + LIMIT 1; + + CALL basketConfigure (CURDATE(), vMethod, vAgency, 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 DROP PROCEDURE IF EXISTS `basketConfirm` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `basketConfirm`() +BEGIN + DECLARE vOrder INT DEFAULT basketGetId (); + + IF vOrder IS NOT NULL + THEN + CALL order_confirm_bionic (vOrder); + + DELETE FROM order_basket + WHERE order_id = vOrder; + 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 DROP PROCEDURE IF EXISTS `basketGetTax` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `basketGetTax`() + READS SQL DATA +BEGIN +/** + * Returns the taxes for the current client basket. + * + * @treturn tmp.orderTax + */ + CALL orderGetTax (basketGetId()); +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 DROP PROCEDURE IF EXISTS `bionic_calc` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -62803,34 +67267,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `bionic_from_type` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `bionic_from_type`(v_type INT) -BEGIN - DECLARE v_date DATE; - DECLARE v_address INT; - DECLARE v_agency INT; - - SELECT date_send, address_id, agency_id - INTO v_date, v_address, v_agency - FROM basket; - - CALL vn2008.bionic_from_type (v_date, v_address, v_agency, v_type); -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 DROP PROCEDURE IF EXISTS `clean` */; +/*!50003 DROP PROCEDURE IF EXISTS `catalogGetAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -62840,125 +67277,138 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN - DECLARE v_i INT DEFAULT 0; - - WHILE v_i < 5 - DO - DROP TEMPORARY TABLE IF EXISTS tmp; - - CREATE TEMPORARY TABLE tmp - ENGINE = MEMORY - SELECT id, COUNT(*) c - FROM order_component - GROUP BY order_row_id, component_id - HAVING c > 1; - - DELETE c FROM order_component c JOIN tmp t ON t.id = c.id; - - DROP TEMPORARY TABLE tmp; - - SET v_i = v_i + 1; - END WHILE; -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 DROP PROCEDURE IF EXISTS `customer_get_debt_by_company` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `customer_get_debt_by_company`() +CREATE DEFINER=`root`@`%` PROCEDURE `catalogGetAvailable`() BEGIN /** - * Calcula el saldo del cliente en cada empresa. + * Gets the available items list that meets the tag filter. * - * @select Saldo desglosado por empresa - **/ - DECLARE v_date_ini DATETIME DEFAULT TIMESTAMP(DATE_FORMAT(TIMESTAMPADD(YEAR, -1, CURDATE()), '%Y-01-01')); - DECLARE v_date_end DATETIME DEFAULT TIMESTAMP(CURDATE(), '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS vn2008.ticket_tmp; - - CREATE TEMPORARY TABLE vn2008.ticket_tmp - (INDEX (ticket_id)) - ENGINE = MEMORY - SELECT t.id ticket_id - FROM ticket_view t - JOIN ticket_row_view r ON t.id = r.ticket_id - JOIN tpv_merchant_enable m ON m.company_id = t.company_id - WHERE invoice IS NULL - AND date BETWEEN v_date_ini AND v_date_end - GROUP BY ticket_id - HAVING BIT_AND(fixed); - - CALL vn2008.ticket_total (); - - CREATE TEMPORARY TABLE t_customer_debt - ENGINE = MEMORY - SELECT e.id, e.abbreviation, IFNULL(SUM(t.amount), 0) amount - FROM vn2008.empresa e - JOIN tpv_merchant_enable m ON m.company_id = e.id - LEFT JOIN - ( - SELECT SUM(t.total) amount, i.company_id - FROM vn2008.ticket_total t - JOIN ticket_view i ON i.id = t.ticket_id - GROUP BY i.company_id - UNION ALL - SELECT r.amount, r.company_id - FROM bi.customer_risk r - JOIN tpv_merchant_enable m ON m.company_id = r.company_id - WHERE customer_id = account.userGetId() - UNION ALL - SELECT -SUM(amount) / 100, company_id - FROM tpv_transaction_view t - JOIN tpv_merchant m ON m.id = t.merchant_id - WHERE t.receipt_id IS NULL AND t.status = 'ok' - GROUP BY company_id - ) t - ON t.company_id = e.id - GROUP BY e.id; - - DROP TEMPORARY TABLE vn2008.ticket_tmp; - DROP TEMPORARY TABLE vn2008.ticket_total; -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 DROP PROCEDURE IF EXISTS `formList` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `formList`() -BEGIN -/** - * Devuelve el listado de formularios web a los que tiene - * acceso el usuario actual. - * - * @table tmp.role Tabla con el listado de formularios + * @table tItems */ - SELECT f.id, f.path, f.description, f.parent - FROM form f - WHERE role_id IN (SELECT id FROM account.userRole) - ORDER BY f.parent, f.display_order, f.id; + CALL itemGetAvailable; + + DELETE t FROM tItems t + JOIN tmp.itemAvailable a ON a.id = t.id + WHERE a.id IS NULL; + + DROP TEMPORARY TABLE tmp.itemAvailable; +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 DROP PROCEDURE IF EXISTS `catalogGetItems` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `catalogGetItems`() +BEGIN +/** + * Returns the list of items. + * + * @table tItems The list of items + * @select The list of items + */ + DROP TEMPORARY TABLE IF EXISTS tmp.bionic_calc; + CREATE TEMPORARY TABLE tmp.bionic_calc + (INDEX (item_id)) + ENGINE = MEMORY + SELECT id item_id FROM tItems; + + CALL bionic_calc (); + DROP TEMPORARY TABLE tmp.bionic_calc; + + SELECT i.id, i.name, i.description, i.category, i.size, i.image, i.inkFk, + IF(i.stems > 1, i.stems, NULL) stems, b.available, b.price, b.producer, + a.tag1, a.val1, a.tag2, a.val2, a.tag3, a.val3 + FROM tmp.bionic_item b + JOIN vn.item i ON i.id = b.item_id + LEFT JOIN vn.itemTagArranged a ON a.itemFk = i.id + LEFT JOIN vn.producer p ON p.id = i.producerFk + WHERE b.available > 0 + ORDER BY i.relevancy DESC, i.name, i.size + LIMIT 40; +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 DROP PROCEDURE IF EXISTS `catalogGetTags` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `catalogGetTags`(vLimit INT) +BEGIN +/** + * Returns the main tags for a list of items. + * + * @table tItems The list of items + * @select The main tags for the passed items + */ + CALL catalogGetAvailable; + + DROP TEMPORARY TABLE IF EXISTS tTags; + CREATE TEMPORARY TABLE tTags + (INDEX (tagFk)) + ENGINE = MEMORY + SELECT it.tagFk, SUM(it.priority) priority + FROM vn.itemTag it + JOIN tItems i ON i.id = it.itemFk + GROUP BY tagFk + LIMIT vLimit; + + SELECT l.id, l.name + FROM tTags t + JOIN vn.tagL10n l ON l.id = t.tagFk + ORDER BY priority DESC; + + DROP TEMPORARY TABLE tTags; +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 DROP PROCEDURE IF EXISTS `catalogGetTagValues` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `catalogGetTagValues`(vTag INT) +BEGIN +/** + * Returns the list of available values for a tag and a list of items. + * + * @table tItems The list of items + * @param vTag The tag identifier + * @select The list of available tags + */ + CALL catalogGetAvailable; + + SELECT DISTINCT it.value + FROM vn.itemTag it + JOIN tItems i ON i.id = it.itemFk + WHERE it.tagFk = vTag + ORDER BY value + LIMIT 200; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63087,7 +67537,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemListVisible` */; +/*!50003 DROP PROCEDURE IF EXISTS `itemGetAvailable` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -63097,106 +67547,34 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `itemListVisible`( - vWh TINYINT - ,vDate DATE - ,vType VARCHAR(255) - ,vPrefix VARCHAR(255) -) +CREATE DEFINER=`root`@`%` PROCEDURE `itemGetAvailable`() BEGIN - DECLARE vPrefixLen SMALLINT; - DECLARE vFilter VARCHAR(255) DEFAULT NULL; - DECLARE vDateInv DATE DEFAULT vn2008.date_inv(); - - SET vPrefixLen = LENGTH(vPrefix); +/** + * Gets the available items list. + * + * @table tmp.itemAvailable + */ + DECLARE vDelivery DATE; + DECLARE vAddress INT; + DECLARE vAgency INT; - IF vPrefix IS NOT NULL AND vPrefixLen > 0 - THEN - SET vFilter = CONCAT(vPrefix, '%'); - SET vPrefixLen = vPrefixLen + 1; - END IF; + SELECT date_send, address_id, agency_id + INTO vDelivery, vAddress, vAgency + FROM basket; + + CALL vn2008.bionic_available_ (vDelivery, vAddress, vAgency); - DROP TEMPORARY TABLE IF EXISTS filter; - CREATE TEMPORARY TABLE filter - (INDEX (item_id)) - ENGINE = MEMORY - SELECT a.Id_Article item_id - FROM vn2008.Articles a - JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE t.Id_Tipo = vType - AND (vFilter IS NULL OR a.Article LIKE vFilter); + DROP TEMPORARY TABLE IF EXISTS tmp.itemAvailable; + CREATE TEMPORARY TABLE tmp.itemAvailable + (INDEX (id)) + ENGINE = MEMORY + SELECT c.item_id id + FROM cache.available c + JOIN vn2008.t_bionic_available a ON c.calc_id = a.calc_id + WHERE c.available > 0 + GROUP BY c.item_id; - DROP TEMPORARY TABLE IF EXISTS current_stock; - CREATE TEMPORARY TABLE current_stock - (INDEX (item_id)) - ENGINE = MEMORY - SELECT item_id, SUM(Cantidad) amount FROM - ( - SELECT Id_Article item_id, Cantidad - FROM vn2008.Compres c - JOIN vn2008.Entradas e USING(Id_Entrada) - JOIN vn2008.travel t ON t.id = e.travel_id - WHERE landing BETWEEN vDateInv AND vDate - AND warehouse_id = vWh - AND NOT Redada - UNION ALL - SELECT Id_Article, -Cantidad - FROM vn2008.Compres c - JOIN vn2008.Entradas e USING(Id_Entrada) - JOIN vn2008.travel t ON t.id = e.travel_id - WHERE shipment BETWEEN vDateInv AND CURDATE() - AND warehouse_id_out = vWh - AND NOT Redada - AND delivered - UNION ALL - SELECT m.Id_Article, -m.Cantidad - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t USING(Id_Ticket) - JOIN vn.ticketState s ON s.ticket = t.Id_Ticket - WHERE t.Fecha BETWEEN vDateInv AND CURDATE() - AND t.warehouse_id = vWh - AND (t.Etiquetasemitidas OR s.alertLevel = 3) - ) t - GROUP BY item_id - HAVING amount > 0; - - DROP TEMPORARY TABLE IF EXISTS tmp; - CREATE TEMPORARY TABLE tmp - (INDEX (item_id)) - ENGINE = MEMORY - SELECT * FROM - ( - SELECT c.Id_Article item_id, c.Id_Compra id, c.Id_Cubo, c.packing - FROM vn2008.Compres c - JOIN vn2008.Entradas e USING(Id_Entrada) - JOIN vn2008.travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN vDateInv AND vDate - AND c.Novincular = FALSE - AND c.Tarifa2 >= 0 - AND Id_Cubo IS NOT NULL - ORDER BY t.warehouse_id = 1 DESC, t.landing DESC - ) t GROUP BY item_id; - - DROP TEMPORARY TABLE IF EXISTS result; - CREATE TEMPORARY TABLE result - ENGINE = MEMORY - SELECT a.Id_Article itemId, IF(vPrefixLen > 0, SUBSTRING(a.Article, vPrefixLen), a.Article) item, - Medida size, CEIL(s.amount) amount, '' location - FROM vn2008.Articles a - JOIN filter f ON f.item_id = a.Id_Article - JOIN current_stock s ON s.item_id = a.Id_Article - LEFT JOIN tmp t ON t.item_id = a.Id_Article - LEFT JOIN vn2008.Cubos c ON c.Id_Cubo = t.Id_Cubo - WHERE s.amount > 0; - - SELECT * FROM result - ORDER BY item, size; - - DROP TEMPORARY TABLE - filter, - current_stock, - tmp, - result; + DROP TEMPORARY TABLE vn2008.t_bionic_available; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63296,6 +67674,299 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `myTicketGet` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `myTicketGet`(vTicket INT) +BEGIN +/** + * Returns a current user ticket header. + * + * @param vTicket The ticket identifier + */ + DECLARE vTaxBase DECIMAL(10,2); + DECLARE vTax DECIMAL(10,2); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT id ticketFk FROM myTicket + WHERE id = vTicket; + + CALL vn.ticketGetTax (); + + SELECT SUM(taxableBase), SUM(tax) + INTO vTaxBase, vTax + FROM tmp.ticketAmount; + + SELECT t.id, t.landed, t.shipped, t.refFk, ag.description agency, + a.street, a.postalCode, a.city, a.nickname, p.name province, + vTaxBase taxBase, vTaxBase + vTax AS total + FROM tmp.ticket v + JOIN vn.ticket t ON t.id = v.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.agencyMode ag ON ag.id = t.agencyModeFk + LEFT JOIN vn.province p ON p.id = a.provinceFk + WHERE t.id = vTicket; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTax, + tmp.ticketAmount; + +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 DROP PROCEDURE IF EXISTS `myTicketGetKk` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `myTicketGetKk`(vTicket INT) +BEGIN +/** + * Returns a current user ticket header. + * + * @param vTicket The ticket identifier + */ + DECLARE vTaxBase DECIMAL(10,2); + DECLARE vTax DECIMAL(10,2); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT id ticketFk FROM myTicket + WHERE id = vTicket; + + CALL vn.ticketGetTax (NULL); + + SELECT SUM(taxBase), SUM(tax + equalizationTax) + INTO vTaxBase, vTax + FROM tmp.ticketTax; + + SELECT t.id, t.landed, t.shipped, t.refFk, ag.description agency, + a.street, a.postalCode, a.city, a.nickname, p.name province, + vTaxBase taxBase, vTaxBase + vTax AS total + FROM tmp.ticket v + JOIN vn.ticket t ON t.id = v.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.agencyMode ag ON ag.id = t.agencyModeFk + LEFT JOIN vn.province p ON p.id = a.provinceFk + WHERE t.id = vTicket; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTax; +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 DROP PROCEDURE IF EXISTS `myTicketGetPackages` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `myTicketGetPackages`(vTicket INT) +BEGIN +/** + * Returns a current user ticket packages. + * + * @param vTicket The ticket identifier + * @select The ticket packages + */ + SELECT i.image, i.id, i.name, tp.quantity + FROM myTicket t + JOIN vn.ticketPackaging tp ON tp.ticketFk = t.id + JOIN vn.package p ON p.id = tp.packagingFk + JOIN vn.item i ON i.id = p.itemFk + WHERE t.id = vTicket; +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 DROP PROCEDURE IF EXISTS `myTicketGetRows` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `myTicketGetRows`(vTicket INT) +BEGIN +/** + * Returns a current user ticket lines. + * + * @param vTicket The ticket identifier + * @select The ticket lines + */ + SELECT r.itemFk, r.quantity, r.concept, r.price, r.discount, + o.code origin, i.category, i.size, i.stems, i.inkFk, i.image + FROM myTicketRow r + JOIN vn.item i ON i.id = r.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + WHERE r.ticketFk = vTicket + ORDER BY r.concept; +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 DROP PROCEDURE IF EXISTS `myTicketList` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `myTicketList`(vFrom DATE, vTo DATE) +BEGIN +/** + * Returns the current user list of tickets between two dates reange. + * Also returns the total price with tax of every ticket. + * + * @param vFrom From date, if %NULL current date minus 25 days + * @param vTo To date, if %NULL current date + * @select The tickets list + */ + SET vFrom = IFNULL(vFrom, DATE_FORMAT(TIMESTAMPADD(DAY, -25, CURDATE()), '%Y-%m-01')); + SET vTo = IFNULL(vTo, TIMESTAMPADD(YEAR, 1, CURDATE())); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT t.id ticketFk + FROM myTicket t + WHERE shipped BETWEEN TIMESTAMP(vFrom) AND TIMESTAMP(vTo, '23:59:59'); + + CALL vn.ticketGetTotal; + + SELECT v.id, IFNULL(v.landed, v.shipped) landed, v.shipped, v.companyFk, + a.city, a.nickname, ag.description agency, t.total + FROM tmp.ticket i + JOIN vn.ticket v ON v.id = i.ticketFk + JOIN vn.address a ON a.id = v.addressFk + JOIN vn.agencyMode ag ON ag.id = agencyModeFk + JOIN tmp.ticketTotal t ON t.ticketFk = i.ticketFk + ORDER BY IFNULL(v.landed, v.shipped) DESC, i.ticketFk DESC; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal; +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 DROP PROCEDURE IF EXISTS `myTicketLogAccess` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `myTicketLogAccess`(vTicket INT) +BEGIN +/** + * Logs an access to a ticket. + * + * @param vTicket The ticket identifier + */ + INSERT INTO vn.ticketLog + (originFk, userFk, `action`, description) + SELECT vTicket, account.userGetId(), 'select', 'Access' + FROM myTicket t + WHERE t.id = vTicket; +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 DROP PROCEDURE IF EXISTS `orderCheckConfig` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `orderCheckConfig`(vOrder INT) +proc: BEGIN +/** + * Comprueba que la configuración del pedido es correcta. + * + * @param vOrder Identificador del pedido + */ + DECLARE vDeliveryMethod VARCHAR(255); + DECLARE vDelivery DATE; + DECLARE vAgency INT; + DECLARE vAddress INT; + + -- Obtiene los datos del pedido + + SELECT d.code, o.date_send, o.agency_id, o.address_id + INTO vDeliveryMethod, vDelivery, vAgency, vAddress + FROM `order` o + JOIN vn.deliveryMethod d ON d.id = o.delivery_method_id + WHERE o.id = vOrder; + + -- Comprueba que se ha seleccionado una dirección + + IF vDeliveryMethod IN ('AGENCY', 'DELIVERY') + && vAddress IS NULL + THEN + CALL util.throw ('ORDER_EMPTY_ADDRESS'); + END IF; + + -- Comprueba que la agencia es correcta + + IF !vn.AgencyIsAvailable (vAgency, vDelivery, vAddress) THEN + CALL util.throw ('ORDER_INVALID_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 DROP PROCEDURE IF EXISTS `orderCheckDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -63314,9 +67985,9 @@ BEGIN DECLARE vDenySunday BOOLEAN; SELECT COUNT(*) INTO vFestive - FROM order_check_festive - WHERE TIMESTAMPADD(YEAR, -YEAR(vDate), vDate) = date - AND accept_orders = FALSE; + FROM orderCheckFestive + WHERE TIMESTAMPADD(YEAR, -YEAR(vDate), vDate) = date + AND acceptOrders = FALSE; IF vDate < CURDATE() THEN @@ -63325,10 +67996,10 @@ BEGIN THEN CALL util.throw ('ORDER_DATE_HOLIDAY'); ELSE - SELECT c.deny_sunday, c.deny_day, IFNULL(w.max_time, c.max_time) - INTO vDenySunday, vDenyDay, vMaxTime - FROM order_check c - LEFT JOIN order_check_wday w + SELECT c.denySunday, c.denyDay, IFNULL(w.maxTime, c.maxTime) + INTO vDenySunday, vDenyDay, vMaxTime + FROM orderCheck c + LEFT JOIN orderCheckWday w ON w.weekday = WEEKDAY(CURDATE()); IF vDate = CURDATE() AND CURTIME() > vMaxTime @@ -63348,7 +68019,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `orderNew` */; +/*!50003 DROP PROCEDURE IF EXISTS `orderConfirm` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -63358,46 +68029,239 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `orderNew`() +CREATE DEFINER=`root`@`%` PROCEDURE `orderConfirm`(vOrder INT) BEGIN - DECLARE vCount INT; - DECLARE vDeliveryMethod INT; - DECLARE vAgency INT; +/** + * Confirms an order, creating each of its tickets on + * the corresponding date and store. + * + * @param vOrder The order identifier + */ + DECLARE vOk BOOL; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vWarehouse INT; + DECLARE vShipment DATETIME; + DECLARE vTicket INT; + DECLARE vNotes VARCHAR(255); + DECLARE vItem INT; + DECLARE vConcept VARCHAR(30); + DECLARE vAmount INT; + DECLARE vPrice DECIMAL(10,2); + DECLARE vSale INT; + DECLARE vRate INT; + DECLARE vEmployee INT; + DECLARE vRowId INT; + DECLARE vDelivery DATE; DECLARE vAddress INT; - DECLARE vWarehouse INT DEFAULT NULL; + DECLARE vAgency INT; + DECLARE vIsConfirmed BOOL; + DECLARE vClientId INT; + DECLARE vCompanyId INT; + DECLARE vAgencyModeId INT; - SELECT COUNT(*) INTO vCount FROM order_view; + DECLARE TICKET_FREE INT DEFAULT 2; + DECLARE SYSTEM_WORKER INT DEFAULT 20; - IF vCount >= 3 THEN - CALL util.throw ('ORDER_MAX_EXCEEDED'); + DECLARE cDates CURSOR FOR + SELECT t.Fecha_envio, r.warehouse_id + FROM `order` o + JOIN order_row r ON r.order_id = o.id + LEFT JOIN vn2008.travel_tree t ON t.warehouse_id = r.warehouse_id + WHERE o.id = vOrder AND r.amount != 0 + GROUP BY warehouse_id; + + DECLARE cRows CURSOR FOR + SELECT r.id, r.item_id, a.Article, r.amount, r.price, r.rate + FROM order_row r + JOIN vn2008.Articles a ON a.Id_Article = r.item_id + WHERE r.amount != 0 + AND r.warehouse_id = vWarehouse + AND r.order_id = vOrder + ORDER BY r.rate DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + -- Carga los datos del pedido + + SELECT o.date_send, o.address_id, o.note, a.agency_id, + o.confirmed, cs.Id_Cliente, o.company_id, o.agency_id + INTO vDelivery, vAddress, vNotes, vAgency, + vIsConfirmed, vClientId, vCompanyId, vAgencyModeId + FROM hedera.`order` o + JOIN vn2008.Agencias a ON a.Id_Agencia = o.agency_id + JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = o.address_id + WHERE id = vOrder; + + -- Comprueba que el pedido no está confirmado + + IF vIsConfirmed THEN + CALL util.throw ('ORDER_ALREADY_CONFIRMED'); END IF; - SELECT co.Id_Consigna, co.Id_Agencia, a.Vista - INTO vAddress, vAgency, vDeliveryMethod - FROM vn2008.Clientes c - LEFT JOIN vn2008.Consignatarios co ON co.Id_Consigna = c.default_address - JOIN vn2008.Agencias a ON a.Id_Agencia = co.Id_Agencia - WHERE c.Id_cliente = user_id(); + -- Comprueba que el pedido no está vacío - INSERT INTO `order` - SET - date_send = CURDATE(), - customer_id = user_id(), - delivery_method_id = IFNULL(vDeliveryMethod, DEFAULT(delivery_method_id)), - agency_id = IFNULL(vAgency, DEFAULT(agency_id)), - address_id = IFNULL(vAddress, DEFAULT(address_id)), - wh_id = IFNULL(vWarehouse, DEFAULT(wh_id)), - type_id = IFNULL(vAgency, DEFAULT(type_id)), - is_bionic = FALSE; - - SELECT LAST_INSERT_ID() order_id; + SELECT COUNT(*) > 0 INTO vOk + FROM order_row WHERE order_id = vOrder AND amount > 0; + + IF !vOk THEN + CALL util.throw ('ORDER_EMPTY'); + END IF; + + -- Carga las fechas de salida de cada almacén + + CALL vn2008.travel_tree (vDelivery, vAddress, vAgency); + + -- Trabajador que realiza la acción + + SELECT Id_Trabajador INTO vEmployee + FROM vn2008.Trabajadores + WHERE user_id = account.userGetId(); + + IF vEmployee IS NULL THEN + SELECT employeeFk INTO vEmployee FROM orderConfig; + END IF; + + -- Crea los tickets del pedido + + START TRANSACTION; + + OPEN cDates; + + lDates: + LOOP + SET vTicket = NULL; + SET vDone = FALSE; + FETCH cDates INTO vShipment, vWarehouse; + + IF vDone THEN + LEAVE lDates; + END IF; + + -- Busca un ticket existente que coincida con los parametros del nuevo pedido + + SELECT Id_Ticket INTO vTicket + FROM vn2008.Tickets t + LEFT JOIN vn.ticketState tls on tls.ticket = t.Id_Ticket + JOIN `order` o + ON o.address_id = t.Id_Consigna + AND vWarehouse = t.warehouse_id + AND o.agency_id = t.Id_Agencia + AND t.landing = o.date_send + AND vShipment = DATE(t.Fecha) + WHERE o.id = vOrder + AND t.Factura IS NULL + AND IFNULL(tls.alertLevel,0) = 0 + AND t.Id_Cliente <> 1118 + LIMIT 1; + + -- Crea el ticket en el caso de no existir uno adecuado + + IF vTicket IS NULL + THEN + CALL vn.ticketCreate ( + vClientId, + IFNULL(vShipment, CURDATE()), + vWarehouse, + vCompanyId, + vAddress, + vAgencyModeId, + NULL, + vDelivery, + vTicket + ); + ELSE + INSERT INTO vncontrol.inter + SET Id_Ticket = vTicket, + Id_Trabajador = SYSTEM_WORKER, + state_id = TICKET_FREE; + END IF; + + INSERT IGNORE INTO vn2008.order_Tickets + SET order_id = vOrder, + Id_Ticket = vTicket; + + -- Añade las notas + + IF vNotes IS NOT NULL AND vNotes != '' + THEN + INSERT INTO vn2008.ticket_observation (Id_Ticket, observation_type_id, text) + VALUES (vTicket, 4/*comercial*/, vNotes) + ON DUPLICATE KEY UPDATE text = CONCAT(VALUES(text),'. ', text); + END IF; + + -- Añade los movimientos y sus componentes + + OPEN cRows; + + lRows: + LOOP + SET vDone = FALSE; + FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate; + + IF vDone THEN + LEAVE lRows; + END IF; + + INSERT INTO vn2008.Movimientos + SET + Id_Article = vItem, + Id_Ticket = vTicket, + Concepte = vConcept, + Cantidad = vAmount, + Preu = vPrice, + CostFixat = 0, + PrecioFijado = TRUE; + + SET vSale = LAST_INSERT_ID(); + + INSERT INTO vn2008.Movimientos_componentes (Id_Movimiento, Id_Componente, Valor) + SELECT vSale, cm.component_id, cm.price + FROM order_component cm + JOIN bi.tarifa_componentes tc ON tc.Id_Componente = cm.component_id + WHERE cm.order_row_id = vRowId + GROUP BY vSale, cm.component_id; + + UPDATE order_row SET Id_Movimiento = vSale + WHERE id = vRowId; + + END LOOP; + + CLOSE cRows; + + -- Fija el Costfixat + + UPDATE vn2008.Movimientos m + JOIN (SELECT SUM(mc.Valor) sum_valor,mc.Id_Movimiento + FROM vn2008.Movimientos_componentes mc + JOIN bi.tarifa_componentes tc USING(Id_Componente) + JOIN bi.tarifa_componentes_series tcs on tcs.tarifa_componentes_series_id = tc.tarifa_componentes_series_id AND tcs.base + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento + WHERE m.Id_Ticket = vTicket + GROUP BY mc.Id_Movimiento) mc ON mc.Id_Movimiento = m.Id_Movimiento + SET m.CostFixat = sum_valor; + END LOOP; + + CLOSE cDates; + + DELETE FROM order_basket WHERE order_id = vOrder; + UPDATE `order` SET confirmed = TRUE, confirm_date = NOW() + WHERE id = vOrder; + + COMMIT; 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 DROP PROCEDURE IF EXISTS `order_check_config` */; +/*!50003 DROP PROCEDURE IF EXISTS `orderGetTax` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -63407,47 +68271,130 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `order_check_config`(v_order INT) -proc: +CREATE DEFINER=`root`@`%` PROCEDURE `orderGetTax`(vOrder INT) + READS SQL DATA BEGIN /** - * Comprueba que la configuración del pedido es correcta. + * Calcula el IVA, y el recargo de equivalencia de un pedido + * desglosados por tipos. * - * @param v_order Identificador del pedido - **/ - DECLARE v_delivery_method VARCHAR(45); - DECLARE v_delivery DATE; - DECLARE v_agency INT; - DECLARE v_address INT; - DECLARE v_ok BOOLEAN; + * @param vOrder El identificador del pedido + * @treturn tmp.orderTax Bases imponibles, IVA y recargo de equivalencia + */ + CALL vn.taxGetRates (NULL); - SELECT v.code, o.date_send, o.agency_id, o.address_id - INTO v_delivery_method, v_delivery, v_agency, v_address - FROM `order` o - JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id - WHERE o.id = v_order; - - -- Comprueba que se ha seleccionado una dirección - - IF v_delivery_method IN ('AGENCY', 'DELIVERY') - && v_address IS NULL - THEN - CALL util.throw ('ORDER_EMPTY_ADDRESS'); - END IF; - - -- Comprueba que la agencia es correcta + -- Calcula el IVA y el recargo desglosado. - CALL agency_list_from_date (v_delivery, v_address); - - SELECT COUNT(*) > 0 INTO v_ok - FROM t_agency - WHERE agency_id = v_agency; - - DROP TEMPORARY TABLE t_agency; - - IF !v_ok THEN - CALL util.throw ('ORDER_INVALID_AGENCY'); + DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; + CREATE TEMPORARY TABLE tmp.orderTax + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT id orderFk, t.type, t.taxBase, + CAST(IF(t.hasTax, t.taxBase * x.rate, 0) AS DECIMAL(10,2)) tax, + CAST(IF(t.hasEqualizationTax, t.taxBase * x.equalizationTax, 0) AS DECIMAL(10,2)) equalizationTax + FROM ( + SELECT o.id, g.countryFk, g.type + ,SUM(CAST(m.amount * m.price AS DECIMAL(10,2))) taxBase + ,NOT(c.isVies AND p.countryFk <> c.countryFk) hasTax + ,c.isEqualizated != FALSE AS hasEqualizationTax + FROM `order` o + JOIN orderRow m ON m.orderFk = o.id + JOIN vn.item a ON a.id = m.itemFk + JOIN vn.client c ON c.id = o.customer_id + JOIN vn.supplier p ON p.id = o.company_id + JOIN tmp.taxClass g + ON g.countryFk = p.countryFk AND g.taxClassFk = a.taxClassFk + WHERE o.id = vOrder + GROUP BY o.id, g.type + ) t + JOIN tmp.taxType x + ON x.countryFk = t.countryFk AND x.type = t.type; + + DROP TEMPORARY TABLE + tmp.taxClass, + tmp.taxType; +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 DROP PROCEDURE IF EXISTS `orderUpdate` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `orderUpdate`(vOrder INT) +proc: BEGIN +/** + * Actualiza la líneas de un pedido. + * + * @param vOrder Id del pedido + */ + DECLARE vDate DATE; + DECLARE vAddress INT; + DECLARE vAgency INT; + DECLARE vNRows INT; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + SELECT COUNT(*) INTO vNRows + FROM order_row WHERE order_id = vOrder; + + IF vNRows > 0 + THEN + SELECT date_send, address_id, agency_id + INTO vDate, vAddress, vAgency + FROM `order` + WHERE id = vOrder; + + CALL vn2008.bionic_from_order (vDate, vAddress, vAgency, vOrder); + + DELETE c + FROM order_row r + JOIN order_component c ON c.order_row_id = r.id + WHERE r.order_id = vOrder; + + UPDATE order_row r + LEFT JOIN tmp.bionic_price l + ON l.warehouse_id = r.warehouse_id + AND l.item_id = r.item_id + AND l.rate = r.rate + LEFT JOIN tmp.travel_tree t + ON t.warehouse_id = r.warehouse_id + SET + r.price = l.price, + r.amount = IF(l.item_id IS NOT NULL, r.amount + IF(@m := MOD(r.amount, l.grouping), l.grouping - @m, 0), 0), + r.shipment = t.Fecha_envio + WHERE r.order_id = vOrder; + + INSERT INTO order_component (order_row_id, component_id, price) + SELECT r.id, c.component_id, c.cost + FROM order_row r + JOIN tmp.bionic_component c + ON c.warehouse_id = r.warehouse_id + AND c.item_id = r.item_id + JOIN bi.tarifa_componentes t + ON t.Id_Componente = c.component_id + AND (t.tarifa_class IS NULL OR t.tarifa_class = r.rate) + WHERE r.order_id = vOrder; END IF; + + UPDATE `order` SET date_make = NOW() + WHERE id = vOrder; + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63464,226 +68411,17 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `order_confirm_bionic`(v_order INT) +CREATE DEFINER=`root`@`%` PROCEDURE `order_confirm_bionic`(vOrder INT) BEGIN /** * Confirma un pedido, creando cada uno de sus tickets en la fecha * y almacén correspondientes. * - * @param v_order Identificador del pedido - **/ - DECLARE v_ok BOOLEAN; - DECLARE v_done BOOLEAN DEFAULT FALSE; - DECLARE v_wh INT; - DECLARE v_shipment DATETIME; - DECLARE v_ticket INT; - DECLARE v_note VARCHAR(255); - DECLARE i_article INT; - DECLARE v_concepte VARCHAR(30); - DECLARE i_amount INT; - DECLARE d_price DOUBLE; - DECLARE i_movimiento INT; - DECLARE i_rate INT; - DECLARE i_worker INT; - DECLARE i_order_row INT; - DECLARE d_delivery DATE; - DECLARE i_address INT; - DECLARE i_agency INT; - DECLARE b_confirmed BOOLEAN; - DECLARE TICKET_FREE INT DEFAULT 2; - DECLARE SYSTEM_WORKER INT DEFAULT 20; - - DECLARE cur_tick CURSOR FOR - SELECT t.Fecha_envio, r.warehouse_id - FROM `order` o - JOIN order_row r ON r.order_id = o.id - LEFT JOIN vn2008.travel_tree t ON t.warehouse_id = r.warehouse_id - WHERE o.id = v_order AND r.amount != 0 - GROUP BY warehouse_id; - - DECLARE cur_mov CURSOR FOR - SELECT r.id, r.item_id, a.Article, r.amount, r.price, r.rate - FROM order_row r - JOIN vn2008.Articles a ON a.Id_Article = r.item_id - WHERE r.amount != 0 - AND r.warehouse_id = v_wh - AND r.order_id = v_order - ORDER BY r.rate DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - -- Carga los datos del pedido - - SELECT o.date_send, o.address_id, o.note, a.agency_id, o.confirmed - INTO d_delivery, i_address, v_note, i_agency, b_confirmed - FROM `order` o - JOIN vn2008.Agencias a ON a.Id_Agencia = o.agency_id - WHERE id = v_order; - - -- Comprueba que el pedido no está confirmado - - IF b_confirmed THEN - CALL util.throw ('ORDER_ALREADY_CONFIRMED'); - END IF; - - -- Comprueba que el pedido no está vacío - - SELECT COUNT(*) > 0 INTO v_ok - FROM order_row WHERE order_id = v_order AND amount > 0; - - IF !v_ok THEN - CALL util.throw ('ORDER_EMPTY'); - END IF; - - -- Carga las fechas de salida de cada almacén - - CALL vn2008.travel_tree (d_delivery, i_address, i_agency); - - -- Trabajador que realiza la acción - - SELECT Id_Trabajador INTO i_worker - FROM vn2008.Trabajadores - WHERE user_id = account.userGetId(); - - IF i_worker IS NULL THEN - SELECT employee_id INTO i_worker FROM order_config; - END IF; - - -- Crea los tickets del pedido - - START TRANSACTION; - - OPEN cur_tick; - - tick_loop: - LOOP - SET v_ticket = NULL; - SET v_done = FALSE; - FETCH cur_tick INTO v_shipment, v_wh; - - IF v_done THEN - LEAVE tick_loop; - END IF; - - -- Busca un ticket existente que coincida con los parametros del nuevo pedido - - SELECT Id_Ticket INTO v_ticket - FROM vn2008.Tickets t - LEFT JOIN vn.ticketState tls on tls.ticket = t.Id_Ticket - JOIN `order` o - ON o.address_id = t.Id_Consigna - AND v_wh = t.warehouse_id - AND o.agency_id = t.Id_Agencia - AND t.landing = o.date_send - AND v_shipment = DATE(t.Fecha) - WHERE o.id = v_order - AND t.Factura IS NULL - AND IFNULL(tls.alertLevel,0) = 0 - /* AND t.PedidoImpreso = 0 - AND t.Etiquetasemitidas = 0 - AND vn2008.is_bionic(t.Id_Ticket) */ - AND t.Id_Cliente <> 1118 - LIMIT 1; - - -- Crea el ticket en el caso de no existir uno adecuado - - IF v_ticket IS NULL - THEN - INSERT INTO vn2008.Tickets ( - Id_Cliente, Fecha, Alias, Id_Agencia, Id_Consigna, - Id_Trabajador, blocked, warehouse_id, Localizacion, landing - ) - SELECT cs.Id_Cliente, IFNULL(v_shipment,CURDATE()), cs.Consignatario, o.agency_id, o.address_id, - i_worker, FALSE, v_wh, IF(v_shipment,'BIONIC','ERROR FECHA ENVIO'), o.date_send - FROM `order` o - JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = o.address_id - WHERE o.id = v_order; - - SET v_ticket = LAST_INSERT_ID(); - ELSE - -- UPDATE vn2008.Tickets SET Localizacion = CONCAT(Localizacion,'B+') WHERE Id_Ticket = v_ticket; - INSERT INTO vncontrol.inter(Id_Ticket, Id_Trabajador, state_id) - VALUES(v_ticket, SYSTEM_WORKER, TICKET_FREE); - - END IF; - - INSERT IGNORE INTO vn2008.order_Tickets (order_id, Id_Ticket) - VALUES (v_order, v_ticket); - - -- Añade las notas - - IF v_note IS NOT NULL && v_note != '' - THEN - INSERT INTO vn2008.ticket_observation (Id_Ticket, observation_type_id, text) - VALUES (v_ticket, 4/*comercial*/ , v_note) - ON DUPLICATE KEY UPDATE text = CONCAT(VALUES(text),'. ', text); - END IF; - - -- Añade los movimientos y sus componentes - - OPEN cur_mov; - - mov_loop: - LOOP - SET v_done = FALSE; - FETCH cur_mov INTO i_order_row, i_article, v_concepte, i_amount, d_price, i_rate; - - IF v_done THEN - LEAVE mov_loop; - END IF; - - INSERT INTO vn2008.Movimientos - SET - Id_Article = i_article, - Id_Ticket = v_ticket, - Concepte = v_concepte, - Cantidad = i_amount, - Preu = d_price, - CostFixat = 0, - PrecioFijado = TRUE; - - SET i_movimiento = LAST_INSERT_ID(); - - INSERT INTO vn2008.Movimientos_componentes (Id_Movimiento, Id_Componente, Valor) - SELECT i_movimiento, cm.component_id, cm.price - FROM order_component cm - JOIN bi.tarifa_componentes tc ON tc.Id_Componente = cm.component_id - WHERE cm.order_row_id = i_order_row - GROUP BY i_movimiento, cm.component_id; - - UPDATE order_row SET Id_Movimiento = i_movimiento - WHERE id = i_order_row; - - END LOOP; - - CLOSE cur_mov; - -- Fija el Costfixat - - UPDATE vn2008.Movimientos m - JOIN (SELECT SUM(mc.Valor) sum_valor,mc.Id_Movimiento - FROM vn2008.Movimientos_componentes mc - join bi.tarifa_componentes tc using(Id_Componente) - join bi.tarifa_componentes_series tcs on tcs.tarifa_componentes_series_id = tc.tarifa_componentes_series_id AND tcs.base - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mc.Id_Movimiento - where m.Id_Ticket = v_ticket - GROUP BY mc.Id_Movimiento) mc ON mc.Id_Movimiento = m.Id_Movimiento - SET m.CostFixat = sum_valor; - END LOOP; - - CLOSE cur_tick; - - DELETE FROM order_basket WHERE order_id = v_order; - UPDATE `order` SET confirmed = TRUE, confirm_date = NOW() - WHERE id = v_order; - - COMMIT; + * @deprecated Use orderConfirm() instead + * + * @param vOrder Identificador del pedido + */ + CALL orderConfirm (vOrder); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63698,187 +68436,30 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `order_get_vat`(v_order INT) +CREATE DEFINER=`root`@`%` PROCEDURE `order_get_vat`(vOrder INT) + READS SQL DATA BEGIN /** * Calcula el IVA, y el recargo de equivalencia de un pedido * desglosados por tipos. * - * @param v_order El identificador del pedido + * @deprecated Use procedure orderGetTax() instead * - * @table t_order_vat Tabla con las bases imponibles, su - * IVA y su recargo de equivalencia. - **/ - DECLARE v_billing_date DATE DEFAULT CURDATE(); - - DECLARE clean CONDITION FOR SQLSTATE 'HY000'; - DECLARE CONTINUE HANDLER FOR clean - BEGIN - DROP TEMPORARY TABLE IF EXISTS t_vat_group; - DROP TEMPORARY TABLE IF EXISTS t_vat_tax; - END; - - SIGNAL clean; - - -- Calcula el tipo de IVA para cada grupo en cada país. - - CREATE TEMPORARY TABLE t_vat_group - (INDEX (country_id, vat_group_id)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT Id_Pais country_id, iva_group_id vat_group_id, c.tipo rate - FROM vn2008.iva_group_codigo g - JOIN vn2008.iva_codigo c ON g.iva_codigo_id = c.id - JOIN vn2008.iva_tipo t ON t.id = c.iva_tipo_id - WHERE date <= v_billing_date - ORDER BY date DESC - ) t - GROUP BY country_id, vat_group_id; - - -- Calcula el impuesto para cada tipo de IVA en cada país. - - CREATE TEMPORARY TABLE t_vat_tax - (INDEX (country_id, rate)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT Id_Pais country_id, tipo rate, - CAST(iva / 100 AS DECIMAL(12, 2)) vat, - CAST(recargo / 100 AS DECIMAL(12, 2)) surcharge - FROM vn2008.iva_codigo - JOIN vn2008.iva_tipo t ON t.id = iva_tipo_id - WHERE Fecha <= v_billing_date AND iva - ORDER BY fecha DESC, recargo DESC - ) t - GROUP BY country_id, rate; - - -- Calcula el IVA y el recargo desglosado. - - DROP TEMPORARY TABLE IF EXISTS t_order_vat; + * @param vOrder El identificador del pedido + * @table t_order_vat Bases imponibles, su IVA y su recargo de equivalencia. + */ + CALL orderGetTax (vOrder); + + DROP TEMPORARY TABLE IF EXISTS t_order_vat; CREATE TEMPORARY TABLE t_order_vat - (INDEX (order_id)) - ENGINE = MEMORY - SELECT order_id, t.rate, t.tax_base, - IF(t.has_vat, t.tax_base * x.vat, 0) vat, - IF(t.has_surcharge, t.tax_base * x.surcharge, 0) surcharge - FROM ( - SELECT o.id order_id, g.country_id, g.rate - ,SUM(m.amount * m.price) AS tax_base - ,NOT(c.VIES AND p.pais_id <> c.Id_Pais) AS has_vat - ,c.RE != FALSE AS has_surcharge - FROM `order` o - JOIN order_row m ON m.order_id = o.id - JOIN vn2008.Articles a ON a.Id_Article = m.item_id - JOIN vn2008.Clientes c ON c.Id_Cliente = o.customer_id - JOIN vn2008.Proveedores p ON p.Id_Proveedor = o.company_id - JOIN t_vat_group g ON g.country_id = p.pais_id AND g.vat_group_id = a.iva_group_id - WHERE o.id = v_order - GROUP BY order_id, rate - ) t - JOIN t_vat_tax x ON x.country_id = t.country_id AND x.rate = t.rate; + ENGINE = MEMORY + SELECT orderFk order_id, type rate, taxBase tax_base, + tax vat, equalizationTax surcharge + FROM tmp.orderTax; - SIGNAL clean; -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 DROP PROCEDURE IF EXISTS `order_update` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `order_update`(v_order INT) -BEGIN - DECLARE v_date DATE; - DECLARE v_address INT; - DECLARE v_agency INT; - DECLARE v_nrows INT; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - SELECT COUNT(*) INTO v_nrows - FROM order_row WHERE order_id = v_order; - - IF v_nrows > 0 - THEN - SELECT date_send, address_id, agency_id - INTO v_date, v_address, v_agency - FROM `order` - WHERE id = v_order; - - CALL vn2008.bionic_from_order (v_date, v_address, v_agency, v_order); - - DELETE c - FROM order_row r - JOIN order_component c ON c.order_row_id = r.id - WHERE r.order_id = v_order; - - UPDATE order_row r - LEFT JOIN tmp.bionic_price l - ON l.warehouse_id = r.warehouse_id - AND l.item_id = r.item_id - AND l.rate = r.rate - LEFT JOIN tmp.travel_tree t - ON t.warehouse_id = r.warehouse_id - SET - r.price = l.price, - r.amount = IF(l.item_id IS NOT NULL, r.amount + IF(@m := MOD(r.amount, l.grouping), l.grouping - @m, 0), 0), - r.shipment = t.Fecha_envio - WHERE r.order_id = v_order; - - INSERT INTO order_component (order_row_id, component_id, price) - SELECT r.id, c.component_id, c.cost - FROM order_row r - JOIN tmp.bionic_component c - ON c.warehouse_id = r.warehouse_id - AND c.item_id = r.item_id - JOIN bi.tarifa_componentes t - ON t.Id_Componente = c.component_id - AND (t.tarifa_class IS NULL OR t.tarifa_class = r.rate) - WHERE r.order_id = v_order; - END IF; - - UPDATE `order` SET date_make = NOW() - WHERE id = v_order; - - COMMIT; -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 DROP PROCEDURE IF EXISTS `sql_query` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `sql_query`(IN v_sql TEXT) -BEGIN - SET @v_sql = v_sql; - - PREPARE stmt FROM @v_sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; + DROP TEMPORARY TABLE tmp.orderTax; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63916,7 +68497,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ticketLog` */; +/*!50003 DROP PROCEDURE IF EXISTS `tpvTransactionConfirm` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -63926,87 +68507,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticketLog`(vticket INT) -BEGIN - INSERT INTO vn2008.Tickets_dits - (idaccion_dits, Id_Trabajador, Id_Ticket) - SELECT 146, 4, id - FROM ticket_view WHERE id = vTicket; -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 DROP PROCEDURE IF EXISTS `ticket_list` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticket_list`() -BEGIN -/** - * Devuelve los tickets del cliente del último mes, calculando - * el total de cada ticket. - * - * @select Listado de tickets - **/ - DROP TEMPORARY TABLE IF EXISTS vn2008.ticket_tmp; - CREATE TEMPORARY TABLE vn2008.ticket_tmp - (KEY (ticket_id)) - ENGINE = MEMORY - SELECT t.id ticket_id FROM ticket_view t - WHERE date > TIMESTAMP(DATE_FORMAT(TIMESTAMPADD(DAY, -25, CURDATE()), '%Y-%m-01')); - - CALL vn2008.ticket_total (); - - DROP TEMPORARY TABLE IF EXISTS t_movement_fixed; - CREATE TEMPORARY TABLE t_movement_fixed - (KEY (ticket_id)) - ENGINE = MEMORY - SELECT ticket_id, BIT_AND(fixed != FALSE) all_fixed - FROM ticket_row_view - JOIN vn2008.ticket_tmp USING(ticket_id) - GROUP BY ticket_id; - - SELECT i.ticket_id, IFNULL(v.delivery, v.`date`) `date`, city, consignee, type, company_id, - IF(all_fixed, t.total, NULL) total, - IF(v.date >= CURDATE() AND v.invoice IS NULL AND all_fixed - ,t.total - ,NULL - ) pending - FROM vn2008.ticket_tmp i - JOIN ticket_view v ON i.ticket_id = v.id - JOIN address_view c ON v.address_id = c.id - JOIN vn2008.ticket_total t USING(ticket_id) - LEFT JOIN t_movement_fixed m USING(ticket_id) - ORDER BY IFNULL(v.delivery, v.`date`) DESC, i.ticket_id DESC; - - DROP TEMPORARY TABLE vn2008.ticket_tmp; - DROP TEMPORARY TABLE vn2008.ticket_total; - DROP TEMPORARY TABLE t_movement_fixed; -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 DROP PROCEDURE IF EXISTS `transactionConfirm` */; -/*!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 = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `transactionConfirm`( +CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransactionConfirm`( vAmount INT ,vOrder INT ,vMerchant INT @@ -64015,6 +68516,18 @@ CREATE DEFINER=`root`@`%` PROCEDURE `transactionConfirm`( ,vErrorCode VARCHAR(10) ) BEGIN +/** + * Confirma una transacción previamente iniciada, reescribiendo + * sus datos por los confirmados por el banco (solo si estos difieren). + * Genera el recibo y su correspondiente entrada en caja. + * + * @param vAmount Cantidad confirmada + * @param vOrder Identificador de transacción + * @param vMerchant Identificador de comercio + * @param vCurrency Identificador de moneda + * @param vResponse Identificador de respuesta del banco + * @param vErrorCode Código de error del banco, si lo hubiera + */ DECLARE vReceipt INT; DECLARE vStatus VARCHAR(10); DECLARE vCustomer INT; @@ -64034,7 +68547,7 @@ BEGIN START TRANSACTION; SELECT COUNT(*) > 0 INTO vIsDuplicated - FROM tpv_transaction + FROM tpvTransaction WHERE id = vOrder AND response IS NOT NULL FOR UPDATE; @@ -64046,20 +68559,20 @@ BEGIN IF vResponse BETWEEN 0 AND 99 THEN SELECT - t.customer_id - ,m.bank_id - ,m.company_id - ,c.employee_id - ,DATE(t.date_time) + t.clientFk + ,m.bankFk + ,m.companyFk + ,c.employeeFk + ,DATE(t.created) INTO vCustomer ,vBank ,vCompany ,vEmployee ,vDate - FROM tpv_merchant m - JOIN tpv_config c ON c.id = 1 - LEFT JOIN tpv_transaction t ON t.id = vOrder + FROM tpvMerchant m + JOIN tpvConfig c ON c.id = 1 + LEFT JOIN tpvTransaction t ON t.id = vOrder WHERE m.id = vMerchant; INSERT INTO vn2008.Recibos @@ -64096,13 +68609,13 @@ BEGIN SET vStatus = 'ko'; END IF; - UPDATE tpv_transaction + UPDATE tpvTransaction SET - merchant_id = vMerchant - ,receipt_id = vReceipt + merchantFk = vMerchant + ,receiptFk = vReceipt ,amount = vAmount ,response = vResponse - ,error_code = vErrorCode + ,errorCode = vErrorCode ,status = vStatus WHERE id = vOrder; @@ -64113,7 +68626,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `transactionConfirmAll` */; +/*!50003 DROP PROCEDURE IF EXISTS `tpvTransactionConfirmAll` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -64123,42 +68636,48 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `transactionConfirmAll`(vDate DATE) +CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransactionConfirmAll`(vDate DATE) BEGIN +/** + * Confirma todas las transacciones confirmadas por el cliente pero no + * por el banco para una fecha dada. + * + * @param vDate Fecha deseada + */ DECLARE vOrder INT; DECLARE vDone BOOLEAN DEFAULT FALSE; DECLARE vDateIni DATETIME DEFAULT TIMESTAMP(vDate, '00:00:00'); DECLARE vDateEnd DATETIME DEFAULT TIMESTAMP(vDate, '23:59:59'); - DECLARE transactions CURSOR FOR + DECLARE cTransactions CURSOR FOR SELECT id - FROM tpv_transaction - WHERE date_time BETWEEN vDateIni AND vDateEnd + FROM tpvTransaction + WHERE created BETWEEN vDateIni AND vDateEnd AND status = 'ok' AND response IS NULL; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - OPEN transactions; + OPEN cTransactions; l: LOOP - FETCH transactions INTO vOrder; + FETCH cTransactions INTO vOrder; IF vDone THEN LEAVE l; END IF; - CALL transactionConfirmById (vOrder); + CALL tpvTransactionConfirmById (vOrder); END LOOP l; - CLOSE transactions; + CLOSE cTransactions; 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 DROP PROCEDURE IF EXISTS `transactionConfirmById` */; +/*!50003 DROP PROCEDURE IF EXISTS `tpvTransactionConfirmById` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -64168,22 +68687,25 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `transactionConfirmById`( - vOrder INT -) +CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransactionConfirmById`(vOrder INT) BEGIN +/** + * Confirma manualmente una transacción espedificando su identificador. + * + * @param vOrder Identificador de la transacción + */ DECLARE vAmount INT; DECLARE vMerchant INT; DECLARE vCurrency INT; - SELECT amount, merchant_id, currency + SELECT amount, merchantFk, currency INTO vAmount, vMerchant, vCurrency - FROM tpv_transaction t - JOIN tpv_merchant m ON t.merchant_id = m.id - JOIN tpv_config c + FROM tpvTransaction t + JOIN tpvMerchant m ON m.id = t.merchantFk + JOIN tpvConfig c WHERE t.id = vOrder; - CALL transactionConfirm ( + CALL tpvTransactionConfirm ( vAmount ,vOrder ,vMerchant @@ -64197,7 +68719,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `transactionEnd` */; +/*!50003 DROP PROCEDURE IF EXISTS `tpvTransactionEnd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -64207,7 +68729,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `transactionEnd`(vTransaction INT, vStatus VARCHAR(12)) +CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransactionEnd`(vTransaction INT, vStatus VARCHAR(12)) BEGIN /** * Finaliza una transaccción estableciendo su estado a 'ok' o @@ -64218,10 +68740,10 @@ BEGIN * * @param vTransaction El identificador de la transacción * @param vStatus El estado, 'ok' o 'ko' - **/ + */ IF vStatus IN ('ok', 'ko') THEN - UPDATE tpv_transaction_view SET status = vStatus + UPDATE myTpvTransaction SET status = vStatus WHERE id = vTransaction AND response IS NULL; END IF; END ;; @@ -64230,7 +68752,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `transactionStart` */; +/*!50003 DROP PROCEDURE IF EXISTS `tpvTransactionStart` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -64240,7 +68762,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `transactionStart`(vAmount INT, vCompany INT) +CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransactionStart`(vAmount INT, vCompany INT) BEGIN /** * Inicia una nueva transacción con el TPV virtual, generando @@ -64252,64 +68774,63 @@ BEGIN * @param vCompany El identificador de la empresa * * @select Los parámetros que deben pasarse al banco - **/ - + */ DECLARE vTransaction CHAR(12); DECLARE vMerchant INT; - DECLARE vUrl VARCHAR(255); - DECLARE vKey VARCHAR(50); - DECLARE vTestMode BOOLEAN; + DECLARE vUrl VARCHAR(255); + DECLARE vKey VARCHAR(50); + DECLARE vTestMode BOOLEAN; - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN ROLLBACK; - RESIGNAL; + RESIGNAL; END; START TRANSACTION; - IF vCompany IS NULL - THEN - SELECT company_id INTO vCompany - FROM tpv_merchant_enable LIMIT 1; + IF vCompany IS NULL + THEN + SELECT companyFk INTO vCompany + FROM tpvMerchantEnable LIMIT 1; END IF; - SELECT merchant_id INTO vMerchant - FROM tpv_merchant_enable WHERE company_id = vCompany; + SELECT merchantFk INTO vMerchant + FROM tpvMerchantEnable WHERE companyFk = vCompany; - SELECT test_mode INTO vTestMode - FROM tpv_config; + SELECT testMode INTO vTestMode + FROM tpvConfig; IF NOT vTestMode THEN - SELECT c.url, m.secret_key INTO vUrl, vKey - FROM tpv_merchant m - JOIN tpv_config c + SELECT c.url, m.secretKey INTO vUrl, vKey + FROM tpvMerchant m + JOIN tpvConfig c WHERE m.id = vMerchant; ELSE - SELECT test_url, test_key INTO vUrl, vKey - FROM tpv_config; - END IF; + SELECT testUrl, testKey INTO vUrl, vKey + FROM tpvConfig; + END IF; - INSERT INTO tpv_transaction_view + INSERT INTO myTpvTransaction SET - merchant_id = vMerchant - ,customer_id = account.userGetId() + merchantFk = vMerchant + ,clientFk = account.userGetId() ,amount = vAmount; - SET vTransaction = LAST_INSERT_ID(); + SET vTransaction = LAST_INSERT_ID(); SELECT vAmount amount ,vTransaction transactionId ,vMerchant merchant ,currency - ,transaction_type transactionType + ,transactionType ,terminal - ,merchant_url merchantUrl + ,merchantUrl ,vUrl url - ,vKey secretKey - FROM tpv_config; + ,vKey secretKey + FROM tpvConfig; COMMIT; END ;; @@ -64318,7 +68839,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `transactionUndo` */; +/*!50003 DROP PROCEDURE IF EXISTS `tpvTransactionUndo` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -64328,7 +68849,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `transactionUndo`( +CREATE DEFINER=`root`@`%` PROCEDURE `tpvTransactionUndo`( vOrder INT ) BEGIN @@ -64349,20 +68870,20 @@ BEGIN START TRANSACTION; SELECT - t.customer_id + t.clientFk ,t.amount / 100 - ,t.receipt_id - ,DATE(t.date_time) - ,m.bank_id + ,t.receiptFk + ,DATE(t.created) + ,m.bankFk INTO vCustomer ,vAmount ,vReceipt ,vDate ,vBank - FROM tpv_transaction t - JOIN tpv_merchant m ON m.id = t.merchant_id - JOIN tpv_config c + FROM tpvTransaction t + JOIN tpvMerchant m ON m.id = t.merchantFk + JOIN tpvConfig c WHERE t.id = vOrder FOR UPDATE; @@ -64403,7 +68924,7 @@ BEGIN -- Actualiza la transaccion - UPDATE tpv_transaction + UPDATE tpvTransaction SET response = NULL, status = 'started' WHERE id = vOrder; @@ -64414,7 +68935,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `type_list` */; +/*!50003 DROP PROCEDURE IF EXISTS `transactionEnd` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -64422,34 +68943,36 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `type_list`(v_realm INT) +CREATE DEFINER=`root`@`%` PROCEDURE `transactionEnd`(vTransaction INT, vStatus VARCHAR(12)) BEGIN /** - * Devuelve los subtipos disponibles para el reino pasado - * utilizando la fecha, dirección y agencia de la cesta de - * la compra. - * - * @param v_realm Id del reino - **/ - DECLARE v_date DATE; - DECLARE v_address INT; - DECLARE v_agency INT; - - SELECT date_send, address_id, agency_id - INTO v_date, v_address, v_agency - FROM basket; - - CALL vn2008.bionic_available_types_ (v_date, v_address, v_agency); - - SELECT t.tipo_id, t.Tipo - FROM vn2008.Tipos t - JOIN vn2008.t_bionic_available_types bt ON bt.tipo_id = t.tipo_id - WHERE t.reino_id = v_realm - ORDER BY t.Orden DESC, t.Tipo; - - DROP TEMPORARY TABLE vn2008.t_bionic_available_types; + * @deprecated Use procedure tpvTransactionEnd() instead + */ + CALL tpvTransactionEnd(vTransaction, vStatus); +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 DROP PROCEDURE IF EXISTS `transactionStart` */; +/*!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 = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `transactionStart`(vAmount INT, vCompany INT) +BEGIN +/** + * @deprecated Use procedure tpvtransactionStart() instead + */ + CALL tpvtransactionStart(vAmount, vCompany); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -64579,3810 +69102,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; --- --- Current Database: `vncontrol` --- - -USE `vncontrol`; - --- --- Current Database: `edi` --- - -USE `edi`; - --- --- Current Database: `vn2008` --- - -USE `vn2008`; - --- --- Final view structure for view `V_edi_item_track` --- - -/*!50001 DROP VIEW IF EXISTS `V_edi_item_track`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `V_edi_item_track` AS select `edi`.`item_track`.`item_id` AS `item_id`,`edi`.`item_track`.`s1` AS `s1`,`edi`.`item_track`.`s2` AS `s2`,`edi`.`item_track`.`s3` AS `s3`,`edi`.`item_track`.`s4` AS `s4`,`edi`.`item_track`.`s5` AS `s5`,`edi`.`item_track`.`s6` AS `s6`,`edi`.`item_track`.`kop` AS `kop`,`edi`.`item_track`.`pac` AS `pac`,`edi`.`item_track`.`cat` AS `cat`,`edi`.`item_track`.`ori` AS `ori`,`edi`.`item_track`.`pro` AS `pro`,`edi`.`item_track`.`sub` AS `sub`,`edi`.`item_track`.`package` AS `package` from `edi`.`item_track` */; -/*!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 `VerEspionaje` --- - -/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `VerEspionaje` AS select `Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`Espionajes`.`Fecha` AS `Fecha`,`Espionajes`.`HoraEntrada` AS `HoraEntrada`,`Espionajes`.`HoraSalida` AS `HoraSalida`,`Espionajes`.`Id_Equipo` AS `Id_Equipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador` from (`Espionajes` join `Trabajadores` on((`Espionajes`.`Id_Trabajador` = `Trabajadores`.`Id_Trabajador`))) order by `Trabajadores`.`CodigoTrabajador`,`Espionajes`.`Fecha` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `account_customer` --- - -/*!50001 DROP VIEW IF EXISTS `account_customer`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `account_customer` AS select `e`.`description` AS `description`,`vn2008`.`cc_to_iban`(concat(`a`.`entity_id`,`a`.`office`,`a`.`DC`,`a`.`number`)) AS `iban`,`a`.`entity_id` AS `entity_id`,`a`.`office` AS `office`,`a`.`DC` AS `dc`,`a`.`number` AS `number` from ((`provider_account_customer` `c` join `Proveedores_account` `a` on((`a`.`Id_Proveedores_account` = `c`.`account_id`))) join `entity` `e` on((`a`.`entity_id` = `e`.`entity_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 `awb_volume` --- - -/*!50001 DROP VIEW IF EXISTS `awb_volume`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `awb_volume` AS select `ar`.`awb_id` AS `awb_id`,(((`c`.`Etiquetas` * `t`.`density`) * if((`cu`.`Volumen` > 0),`cu`.`Volumen`,((`cu`.`X` * `cu`.`Y`) * if((`cu`.`Z` = 0),(`a`.`Medida` + 10),`cu`.`Z`)))) / 167000) AS `volume` from (((((((`Compres` `c` join `Articles` `a` on((`c`.`Id_Article` = `a`.`Id_Article`))) join `Tipos` `t` on((`a`.`tipo_id` = `t`.`tipo_id`))) join `Cubos` `cu` on((`cu`.`Id_Cubo` = `c`.`Id_Cubo`))) join `Entradas` `e` on((`c`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `tr` on((`tr`.`id` = `e`.`travel_id`))) join `recibida_entrada` `re` on((`c`.`Id_Entrada` = `re`.`Id_Entrada`))) join `awb_recibida` `ar` on((`re`.`awb_recibida` = `ar`.`recibida_id`))) where (`tr`.`shipment` > makedate((year(curdate()) - 1),1)) */; -/*!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` --- - -/*!50001 DROP VIEW IF EXISTS `cdr`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `cdr` AS select `c`.`call_date` AS `calldate`,`c`.`clid` AS `clid`,`c`.`src` AS `src`,`c`.`dst` AS `dst`,`c`.`dcontext` AS `dcontext`,`c`.`channel` AS `channel`,`c`.`dst_channel` AS `dstchannel`,`c`.`last_app` AS `lastapp`,`c`.`last_data` AS `lastdata`,`c`.`duration` AS `duration`,`c`.`billsec` AS `billsec`,`c`.`disposition` AS `disposition`,`c`.`ama_flags` AS `amaflags`,`c`.`account_code` AS `accountcode`,`c`.`unique_id` AS `uniqueid`,`c`.`user_field` AS `userfield` from `pbx`.`cdr` `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 `clientMana` --- - -/*!50001 DROP VIEW IF EXISTS `clientMana`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientMana` AS select `t`.`Id_Cliente` AS `Id_Cliente`,`mc`.`Valor` AS `ManaUnitario`,(`mc`.`Valor` * `m`.`Cantidad`) AS `ManaTotal`,`t`.`Id_Ticket` AS `Id_Ticket`,`m`.`Id_Article` AS `Id_Article`,`m`.`Concepte` AS `Concepte`,`m`.`Cantidad` AS `Cantidad`,`m`.`Preu` AS `Preu`,`t`.`Fecha` AS `Fecha`,`m`.`Id_Movimiento` AS `Id_Movimiento` from ((((`vn2008`.`Tickets` `t` join `vn2008`.`Movimientos` `m` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) join `vn2008`.`Movimientos_componentes` `mc` on((`mc`.`Id_Movimiento` = `m`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on((`tc`.`Id_Componente` = `mc`.`Id_Componente`))) join `vn2008`.`tarifa_componentes_series` `tcs` on((`tc`.`tarifa_componentes_series_id` = `tcs`.`tarifa_componentes_series_id`))) where ((`t`.`Fecha` >= '2016-01-01') and (`tcs`.`Serie` = 'cartera_comercial') and (`mc`.`Valor` <> 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 `edi_article` --- - -/*!50001 DROP VIEW IF EXISTS `edi_article`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_article` AS select `edi`.`item`.`id` AS `id`,`edi`.`item`.`product_name` AS `product_name`,`edi`.`item`.`name` AS `name`,`edi`.`item`.`plant_id` AS `plant_id`,`edi`.`item`.`group_id` AS `group_id`,`edi`.`item`.`entry_date` AS `entry_date`,`edi`.`item`.`expiry_date` AS `expiry_date`,`edi`.`item`.`change_date_time` AS `change_date_time` from `edi`.`item` */; -/*!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_bucket` --- - -/*!50001 DROP VIEW IF EXISTS `edi_bucket`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_bucket` AS select (cast(`edi`.`bucket`.`bucket_id` as char charset utf8) collate utf8_general_ci) AS `bucket_id`,`edi`.`bucket`.`bucket_type_id` AS `bucket_type_id`,`edi`.`bucket`.`description` AS `description`,`edi`.`bucket`.`x_size` AS `x_size`,`edi`.`bucket`.`y_size` AS `y_size`,`edi`.`bucket`.`z_size` AS `z_size`,`edi`.`bucket`.`entry_date` AS `entry_date`,`edi`.`bucket`.`expiry_date` AS `expiry_date`,`edi`.`bucket`.`change_date_time` AS `change_date_time` from `edi`.`bucket` */; -/*!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_bucket_type` --- - -/*!50001 DROP VIEW IF EXISTS `edi_bucket_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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_bucket_type` AS select `edi`.`bucket_type`.`bucket_type_id` AS `bucket_type_id`,`edi`.`bucket_type`.`description` AS `description`,`edi`.`bucket_type`.`entry_date` AS `entry_date`,`edi`.`bucket_type`.`expiry_date` AS `expiry_date`,`edi`.`bucket_type`.`change_date_time` AS `change_date_time` from `edi`.`bucket_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_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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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` --- - -/*!50001 DROP VIEW IF EXISTS `edi_specie`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_specie` AS select `edi`.`specie`.`specie_id` AS `specie_id`,`edi`.`specie`.`genus_id` AS `genus_id`,`edi`.`specie`.`latin_species_name` AS `latin_species_name`,`edi`.`specie`.`entry_date` AS `entry_date`,`edi`.`specie`.`expiry_date` AS `expiry_date`,`edi`.`specie`.`change_date_time` AS `change_date_time` from `edi`.`specie` */; -/*!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_supplier` --- - -/*!50001 DROP VIEW IF EXISTS `edi_supplier`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_supplier` AS select `edi`.`supplier`.`supplier_id` AS `supplier_id`,`edi`.`supplier`.`company_name` AS `company_name` from `edi`.`supplier` */; -/*!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_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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 `itemTagArranged` --- - -/*!50001 DROP VIEW IF EXISTS `itemTagArranged`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTagArranged` AS select `i`.`itemFk` AS `itemFk`,`i`.`tag1` AS `tag1`,`i`.`val1` AS `val1`,`i`.`tag2` AS `tag2`,`i`.`val2` AS `val2`,`i`.`tag3` AS `tag3`,`i`.`val3` AS `val3`,`i`.`tag4` AS `tag4`,`i`.`val4` AS `val4`,`i`.`tag5` AS `tag5`,`i`.`val5` AS `val5`,`i`.`tag6` AS `tag6`,`i`.`val6` AS `val6`,`i`.`description` AS `description` from `vn`.`itemTagArranged` `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_entry_in` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`landing` AS `dat`,`m`.`Id_Article` AS `item_id`,`m`.`Cantidad` AS `amount`,`t`.`received` AS `received` from ((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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` AS `delivered` from ((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `t` on((`e`.`travel_id` = `t`.`id`))) 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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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`,(`ts`.`alertLevel` = 3) AS `ready`,`t`.`Factura` AS `invoice`,ifnull(`ts`.`alertLevel`,0) AS `alertLevel` from ((`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) left join `vn`.`ticketState` `ts` on((`t`.`Id_Ticket` = `ts`.`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 `new_view` --- - -/*!50001 DROP VIEW IF EXISTS `new_view`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `new_view` AS select `vn`.`workerDocument`.`id` AS `id`,`vn`.`workerDocument`.`worker` AS `worker`,`vn`.`workerDocument`.`document` AS `document` 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 `order` --- - -/*!50001 DROP VIEW IF EXISTS `order`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `order` AS select `hedera`.`order`.`id` AS `id`,`hedera`.`order`.`date_make` AS `date_make`,`hedera`.`order`.`date_send` AS `date_send`,`hedera`.`order`.`customer_id` AS `customer_id`,`hedera`.`order`.`delivery_method_id` AS `delivery_method_id`,`hedera`.`order`.`agency_id` AS `agency_id`,`hedera`.`order`.`address_id` AS `address_id`,`hedera`.`order`.`note` AS `note`,`hedera`.`order`.`confirmed` AS `confirmed`,`hedera`.`order`.`is_bionic` AS `is_bionic`,`hedera`.`order`.`source_app` AS `source_app` from `hedera`.`order` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order_component` --- - -/*!50001 DROP VIEW IF EXISTS `order_component`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_component` AS select `c`.`order_row_id` AS `order_row_id`,`c`.`component_id` AS `component_id`,`c`.`price` AS `price` from `hedera`.`order_component` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `order_row` --- - -/*!50001 DROP VIEW IF EXISTS `order_row`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_row` AS select `hedera`.`order_row`.`id` AS `id`,`hedera`.`order_row`.`order_id` AS `order_id`,`hedera`.`order_row`.`item_id` AS `item_id`,`hedera`.`order_row`.`warehouse_id` AS `warehouse_id`,`hedera`.`order_row`.`shipment` AS `shipment`,`hedera`.`order_row`.`amount` AS `amount`,`hedera`.`order_row`.`price` AS `price`,`hedera`.`order_row`.`rate` AS `rate`,`hedera`.`order_row`.`created` AS `created`,`hedera`.`order_row`.`Id_Movimiento` AS `Id_Movimiento` from `hedera`.`order_row` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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`.`userGetId`()) */; -/*!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_clientes` --- - -/*!50001 DROP VIEW IF EXISTS `proveedores_clientes`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `proveedores_clientes` AS select `Proveedores`.`Id_Proveedor` AS `Id_Proveedor`,`Proveedores`.`Proveedor` AS `Proveedor`,`Clientes`.`id_cliente` AS `Id_Cliente`,`Clientes`.`cliente` AS `Cliente` from (`Proveedores` join `Clientes` on((`Proveedores`.`NIF` = `Clientes`.`if`))) */; -/*!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 `root` --- - -/*!50001 DROP VIEW IF EXISTS `root`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `root` AS select dayname(`h`.`confirm_date`) AS `DiadelaSemana`,hour(`h`.`confirm_date`) AS `Hora`,cast(`h`.`confirm_date` as date) AS `Fecha`,`h`.`source_app` AS `Dispositivo` from `hedera`.`order` `h` where `h`.`confirm_date` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `tarifa_componentes` --- - -/*!50001 DROP VIEW IF EXISTS `tarifa_componentes`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `tarifa_componentes` AS select `bi`.`tarifa_componentes`.`Id_Componente` AS `Id_Componente`,`bi`.`tarifa_componentes`.`Componente` AS `Componente`,`bi`.`tarifa_componentes`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`,`bi`.`tarifa_componentes`.`tarifa_class` AS `tarifa_class`,`bi`.`tarifa_componentes`.`tax` AS `tax`,`bi`.`tarifa_componentes`.`is_renewable` AS `is_renewable` from `bi`.`tarifa_componentes` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `tarifa_componentes_series` --- - -/*!50001 DROP VIEW IF EXISTS `tarifa_componentes_series`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `tarifa_componentes_series` AS select `bi`.`tarifa_componentes_series`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`,`bi`.`tarifa_componentes_series`.`Serie` AS `Serie`,`bi`.`tarifa_componentes_series`.`base` AS `base` from `bi`.`tarifa_componentes_series` */; -/*!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 `ticketCreationData` --- - -/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketCreationData` AS select dayname(`h`.`confirm_date`) AS `DiadelaSemana`,hour(`h`.`confirm_date`) AS `Hora`,cast(`h`.`confirm_date` as date) AS `Fecha`,`h`.`source_app` AS `Dispositivo` from `hedera`.`order` `h` where `h`.`confirm_date` */; -/*!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_Agenda` --- - -/*!50001 DROP VIEW IF EXISTS `v_Agenda`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_Agenda` AS select 'P' AS `Tipo`,`Proveedores`.`Id_Proveedor` AS `Id`,`Proveedores`.`Proveedor` AS `Nombre`,`Proveedores`.`Telefono` AS `Telephone` from `Proveedores` where (`Proveedores`.`Telefono` is not null) union select 'C' AS `Tipo`,`Clientes`.`id_cliente` AS `Id`,`Clientes`.`cliente` AS `Cliente`,`Clientes`.`telefono` AS `Telefono` from `Clientes` where (`Clientes`.`telefono` is not null) union select 'C' AS `Tipo`,`Clientes`.`id_cliente` AS `Id`,`Clientes`.`cliente` AS `Cliente`,`Clientes`.`movil` AS `Movil` from `Clientes` where (`Clientes`.`movil` is not null) union select if(isnull(`Relaciones`.`Id_Proveedor`),'C','P') AS `Tipo`,if(isnull(`Relaciones`.`Id_Proveedor`),`Relaciones`.`Id_Cliente`,`Relaciones`.`Id_Proveedor`) AS `Id`,`Contactos`.`Nombre` AS `Nombre`,`Contactos`.`Telefono` AS `Telefono` from (`Contactos` join `Relaciones` on((`Contactos`.`Id_Contacto` = `Relaciones`.`Id_Contacto`))) where (`Contactos`.`Telefono` is not null) union select if(isnull(`Relaciones`.`Id_Proveedor`),'C','P') AS `Tipo`,if(isnull(`Relaciones`.`Id_Proveedor`),`Relaciones`.`Id_Cliente`,`Relaciones`.`Id_Proveedor`) AS `Id`,`Contactos`.`Nombre` AS `Nombre`,`Contactos`.`Movil` AS `Movil` from (`Contactos` join `Relaciones` on((`Contactos`.`Id_Contacto` = `Relaciones`.`Id_Contacto`))) where (`Contactos`.`Movil` is not null) union select 'T' AS `Tipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador`,`Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`Trabajadores`.`extension` AS `extension` from `Trabajadores` where (`Trabajadores`.`extension` is not null) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_Agenda2` --- - -/*!50001 DROP VIEW IF EXISTS `v_Agenda2`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_Agenda2` AS select `v_Agenda`.`Tipo` AS `Tipo`,`v_Agenda`.`Id` AS `Id`,`v_Agenda`.`Nombre` AS `Nombre`,replace(`v_Agenda`.`Telephone`,' ','') AS `Telefono` from `v_Agenda` where `v_Agenda`.`Telephone` group by replace(`v_Agenda`.`Telephone`,' ','') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_Articles_botanical` --- - -/*!50001 DROP VIEW IF EXISTS `v_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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_Articles_botanical` AS select `ab`.`Id_Article` AS `Id_Article`,ifnull(`ab`.`botanical`,concat(`g`.`latin_genus_name`,' ',ifnull(`s`.`latin_species_name`,''))) AS `edi_botanic` from ((`vn2008`.`Articles_botanical` `ab` left join `edi`.`genus` `g` on((`ab`.`genus_id` = `g`.`genus_id`))) left join `edi`.`specie` `s` on((`s`.`specie_id` = `ab`.`specie_id`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_Movimientos_Volumen_shipping_charge` --- - -/*!50001 DROP VIEW IF EXISTS `v_Movimientos_Volumen_shipping_charge`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_Movimientos_Volumen_shipping_charge` AS select `M`.`Id_Ticket` AS `Id_Ticket`,`M`.`Id_Movimiento` AS `Id_Movimiento`,`t`.`Fecha` AS `Fecha`,`az`.`price` AS `price`,((`M`.`Cantidad` * ((`CM3`(`b`.`Id_Compra`) / 1000000) / `C`.`Packing`)) * (`az`.`price` / 0.08)) AS `freight` from (((((((`vn2008`.`Movimientos` `M` join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `M`.`Id_Ticket`))) join `vn2008`.`Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `bi`.`Last_buy_id` `b` on(((`M`.`Id_Article` = `b`.`Id_Article`) and (`t`.`warehouse_id` = `b`.`warehouse_id`)))) join `vn2008`.`Compres` `C` on((`b`.`Id_Compra` = `C`.`Id_Compra`))) join `vn2008`.`Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `vn2008`.`Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `vn2008`.`Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = 71)))) */; -/*!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_Ordenes` --- - -/*!50001 DROP VIEW IF EXISTS `v_Ordenes`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_Ordenes` AS select `Ordenes`.`Id_ORDEN` AS `Id_ORDEN`,`Ordenes`.`ORDEN` AS `ORDEN`,`Ordenes`.`datORDEN` AS `datORDEN`,`Ordenes`.`datTICKET` AS `datTICKET`,`Ordenes`.`CodVENDEDOR` AS `CodVENDEDOR`,`Ordenes`.`CodCOMPRADOR` AS `CodCOMPRADOR`,`Ordenes`.`CANTIDAD` AS `CANTIDAD`,`Ordenes`.`PRECIOMAX` AS `PRECIOMAX`,`Ordenes`.`PREU` AS `PREU`,`Ordenes`.`Id_ARTICLE` AS `Id_ARTICLE`,`Ordenes`.`Id_CLIENTE` AS `Id_CLIENTE`,`Ordenes`.`COMENTARIO` AS `COMENTARIO`,`Ordenes`.`OK` AS `OK`,`Ordenes`.`TOTAL` AS `TOTAL`,`Ordenes`.`datCOMPRA` AS `datCOMPRA`,`Ordenes`.`KO` AS `KO`,`Ordenes`.`Id_Movimiento` AS `Id_Movimiento`,`Ordenes`.`odbc_date` AS `odbc_date` from `Ordenes` */; -/*!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_XDiario_ALL` --- - -/*!50001 DROP VIEW IF EXISTS `v_XDiario_ALL`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_XDiario_ALL` AS select `bi`.`XDiario_ALL`.`empresa_id` AS `empresa_id`,`bi`.`XDiario_ALL`.`SUBCTA` AS `SUBCTA`,`bi`.`XDiario_ALL`.`Eurodebe` AS `Eurodebe`,`bi`.`XDiario_ALL`.`Eurohaber` AS `Eurohaber`,`bi`.`XDiario_ALL`.`Fecha` AS `Fecha`,`bi`.`XDiario_ALL`.`FECHA_EX` AS `FECHA_EX` from `bi`.`XDiario_ALL` */; -/*!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_accion` --- - -/*!50001 DROP VIEW IF EXISTS `v_accion`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_accion` AS select `vncontrol`.`accion`.`accion_id` AS `accion_id`,`vncontrol`.`accion`.`accion` AS `accion` from `vncontrol`.`accion` */; -/*!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_account` --- - -/*!50001 DROP VIEW IF EXISTS `v_account`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_account` AS select `a`.`id` AS `user_id` from `account`.`account` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_analisis_ventas` --- - -/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_analisis_ventas` AS select `bi`.`analisis_ventas`.`Familia` AS `Familia`,`bi`.`analisis_ventas`.`Reino` AS `Reino`,`bi`.`analisis_ventas`.`Comercial` AS `Comercial`,`bi`.`analisis_ventas`.`Comprador` AS `Comprador`,`bi`.`analisis_ventas`.`Provincia` AS `Provincia`,`bi`.`analisis_ventas`.`almacen` AS `almacen`,`bi`.`analisis_ventas`.`Año` AS `Año`,`bi`.`analisis_ventas`.`Mes` AS `Mes`,`bi`.`analisis_ventas`.`Semana` AS `Semana`,`bi`.`analisis_ventas`.`Vista` AS `Vista`,`bi`.`analisis_ventas`.`Importe` AS `Importe` from `bi`.`analisis_ventas` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_awb_volumen` --- - -/*!50001 DROP VIEW IF EXISTS `v_awb_volumen`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_awb_volumen` AS select `a`.`id` AS `awb_id`,`a`.`codigo` AS `codigo`,`a`.`importe` AS `importe`,cast(sum(`v`.`volume`) as signed) AS `Vol_Total` from (`awb` `a` join `awb_volume` `v` on((`v`.`awb_id` = `a`.`id`))) group by `a`.`id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_barcodes` --- - -/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_barcodes` AS select `Articles`.`Id_Article` AS `code`,`Articles`.`Id_Article` AS `Id_Article` from `Articles` union all select `barcodes`.`code` AS `code`,`barcodes`.`Id_Article` AS `Id_Article` from `barcodes` union all select `c`.`Id_Compra` AS `Id_Compra`,`c`.`Id_Article` AS `Id_Article` from ((`Compres` `c` join `Entradas` `e` on((`c`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `tr` on((`tr`.`id` = `e`.`travel_id`))) where (`tr`.`landing` >= (curdate() + interval -(15) day)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_barcodes_plus` --- - -/*!50001 DROP VIEW IF EXISTS `v_barcodes_plus`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_barcodes_plus` AS select `cache`.`barcodes`.`code` AS `code`,`cache`.`barcodes`.`Id_Article` AS `Id_Article`,`cache`.`barcodes`.`Article` AS `Article`,`cache`.`barcodes`.`Medida` AS `Medida`,`cache`.`barcodes`.`Color` AS `Color`,`cache`.`barcodes`.`Categoria` AS `Categoria`,`cache`.`barcodes`.`Producer` AS `Producer` from `cache`.`barcodes` */; -/*!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_botanic_export` --- - -/*!50001 DROP VIEW IF EXISTS `v_botanic_export`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_botanic_export` AS select concat(ifnull(concat(`eg`.`latin_genus_name`,' '),''),ifnull(`es`.`latin_species_name`,'')) AS `Nom_botanic`,`be`.`Id_Paises` AS `Id_Paises`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description` from ((`vn2008`.`botanic_export` `be` left join `vn2008`.`edi_genus` `eg` on((`be`.`edi_genus_id` = `eg`.`genus_id`))) left join `vn2008`.`edi_specie` `es` on((`be`.`edi_specie_id` = `es`.`specie_id`))) order by concat(`eg`.`latin_genus_name`,' ',`es`.`latin_species_name`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_compres` --- - -/*!50001 DROP VIEW IF EXISTS `v_compres`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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`,`an`.`nicho` AS `Nicho`,`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`,`A`.`iva_group_id` AS `iva_group_id`,(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 (((((((((`Compres` `C` join `Entradas` `E` on((`C`.`Id_Entrada` = `E`.`Id_Entrada`))) join `travel` `TR` on((`TR`.`id` = `E`.`travel_id`))) join `warehouse` `W_IN` on((`W_IN`.`id` = `TR`.`warehouse_id`))) join `warehouse` `W_OUT` on((`W_OUT`.`id` = `TR`.`warehouse_id_out`))) join `Articles` `A` on((`C`.`Id_Article` = `A`.`Id_Article`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) join `reinos` `RN` on((`RN`.`id` = `TP`.`reino_id`))) join `Cubos` `cb` on((`cb`.`Id_Cubo` = `C`.`Id_Cubo`))) left join `Articles_nicho` `an` on(((`A`.`Id_Article` = `an`.`Id_Article`) and (`an`.`warehouse_id` = `W_IN`.`id`)))) where ((not(`W_IN`.`fuente`)) and (not(`E`.`Inventario`)) and (not(`E`.`Redada`))) */; -/*!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_departure_limit` --- - -/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_departure_limit` AS select `cache`.`departure_limit`.`warehouse_id` AS `warehouse_id`,`cache`.`departure_limit`.`fecha` AS `fecha`,`cache`.`departure_limit`.`hora` AS `hora`,`cache`.`departure_limit`.`minSpeed` AS `minSpeed` from `cache`.`departure_limit` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_descuadre_bionic` --- - -/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_descuadre_bionic` AS select `t`.`Id_Ticket` AS `Id_Ticket`,`t`.`Alias` AS `Alias`,`m`.`Concepte` AS `Concepte`,sum(`mc`.`Valor`) AS `suma_componente`,`m`.`Preu` AS `Preu`,`m`.`Descuento` AS `Descuento`,(((`m`.`Preu` * (100 - `m`.`Descuento`)) / 100) - sum(`mc`.`Valor`)) AS `diferencia`,`t`.`Fecha` AS `Fecha`,((`m`.`Preu` > 0) and (`tp`.`reino_id` <> 6) and (`a`.`tipo_id` not in (7,115)) and (`t`.`warehouse_id` <> 41)) AS `benvenut` from ((((((`Movimientos` `m` join `Tickets` `t` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) join `Clientes` `c` on((`t`.`Id_Cliente` = `c`.`id_cliente`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouse_id`))) join `Articles` `a` on((`m`.`Id_Article` = `a`.`Id_Article`))) join `Tipos` `tp` on((`a`.`tipo_id` = `tp`.`tipo_id`))) left join `Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567)) and `w`.`reserve` and `c`.`real` and (`tp`.`reino_id` <> 6)) group by `m`.`Id_Movimiento` having ((abs(`diferencia`) > 0.01) or isnull(`diferencia`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_descuadre_porte` --- - -/*!50001 DROP VIEW IF EXISTS `v_descuadre_porte`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_descuadre_porte` AS select `t`.`Id_Ticket` AS `Id_Ticket`,round(sum((`mc`.`Valor` * `m`.`Cantidad`)),2) AS `suma_componente`,round(`es`.`shipping_charge`,2) AS `teorico_agencia`,round((sum((`mc`.`Valor` * `m`.`Cantidad`)) - `es`.`shipping_charge`),2) AS `diferencia`,`t`.`Fecha` AS `Fecha` from ((((`vn2008`.`Movimientos` `m` left join `vn2008`.`Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on(((`tc`.`Id_Componente` = `mc`.`Id_Componente`) and (`tc`.`tarifa_componentes_series_id` = 6)))) join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) left join `vn2008`.`v_expeditions_shipping_charge` `es` on((`es`.`Id_Ticket` = `t`.`Id_Ticket`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` having ((abs(`diferencia`) > 0.01) or isnull(`diferencia`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_descuadre_porte2` --- - -/*!50001 DROP VIEW IF EXISTS `v_descuadre_porte2`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_descuadre_porte2` AS select `t`.`Id_Ticket` AS `Id_Ticket`,(`mc`.`Valor` * `m`.`Cantidad`) AS `suma_componente`,`t`.`Fecha` AS `Fecha` from (((`vn2008`.`Movimientos` `m` left join `vn2008`.`Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on(((`tc`.`Id_Componente` = `mc`.`Id_Componente`) and (`tc`.`tarifa_componentes_series_id` = 6)))) join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_empresa` --- - -/*!50001 DROP VIEW IF EXISTS `v_empresa`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_empresa` AS select `e`.`logo` AS `logo`,`e`.`id` AS `id`,`e`.`registro` AS `registro`,`e`.`gerente_id` AS `gerente_id`,`e`.`alta` AS `alta`,`t`.`Nombre` AS `Nombre`,`t`.`Apellidos` AS `Apellidos`,`p`.`Proveedor` AS `Proveedor`,`p`.`Domicilio` AS `Domicilio`,`p`.`CP` AS `CP`,`p`.`Localidad` AS `Localidad`,`p`.`NIF` AS `NIF`,`p`.`Telefono` AS `Telefono`,`p`.`Alias` AS `Alias`,`e`.`abbreviation` AS `abbreviation` from ((`empresa` `e` join `Trabajadores` `t` on((`t`.`Id_Trabajador` = `e`.`gerente_id`))) join `Proveedores` `p` on((`p`.`Id_Proveedor` = `e`.`id`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_encajado` --- - -/*!50001 DROP VIEW IF EXISTS `v_encajado`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_encajado` AS select hour(`e`.`odbc_date`) AS `hora`,minute(`e`.`odbc_date`) AS `minuto`,ifnull(`c`.`Volumen`,94500) AS `cm3`,`t`.`warehouse_id` AS `warehouse_id` from ((`expeditions` `e` left join `Cubos` `c` on((`c`.`item_id` = `e`.`EsBulto`))) join `Tickets` `t` on((`t`.`Id_Ticket` = `e`.`ticket_id`))) where (`e`.`odbc_date` between curdate() and `DAYEND`(curdate())) */; -/*!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_encajado_ultima_hora` --- - -/*!50001 DROP VIEW IF EXISTS `v_encajado_ultima_hora`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_encajado_ultima_hora` AS select sum((ifnull(`c`.`Volumen`,94500) / 1000000)) AS `m3`,`t`.`warehouse_id` AS `warehouse_id` from ((`expeditions` `e` left join `Cubos` `c` on((`c`.`item_id` = `e`.`EsBulto`))) join `Tickets` `t` on((`t`.`Id_Ticket` = `e`.`ticket_id`))) where ((`e`.`odbc_date` > (now() + interval -(1) hour)) and (`t`.`warehouse_id` in (1,44))) group by `t`.`warehouse_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_expeditions_shipping_charge` --- - -/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_charge`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_expeditions_shipping_charge` AS select `t`.`Id_Ticket` AS `Id_Ticket`,sum((`az`.`price` * if(((`e`.`EsBulto` = 71) and isnull(`e`.`Id_Article`) and (`a`.`Vista` = 2)),0.75,1))) AS `shipping_charge`,`t`.`Fecha` AS `Fecha` from ((((((`Tickets` `t` join `Clientes` `cli` on((`cli`.`id_cliente` = `t`.`Id_Cliente`))) left join `expeditions` `e` on((`e`.`ticket_id` = `t`.`Id_Ticket`))) join `Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = `e`.`EsBulto`)))) where ((`t`.`Fecha` >= '2015-10-01') and (`cli`.`real` <> 0) and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_expeditions_shipping_charge2` --- - -/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_charge2`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_expeditions_shipping_charge2` AS select `t`.`Id_Ticket` AS `Id_Ticket`,(`az`.`price` * if(((`e`.`EsBulto` = 71) and isnull(`e`.`Id_Article`) and (`a`.`Vista` = 2)),0.75,1)) AS `shipping_charge`,`t`.`Fecha` AS `Fecha`,`t`.`warehouse_id` AS `warehouse_id` from (((((`Tickets` `t` left join `expeditions` `e` on((`e`.`ticket_id` = `t`.`Id_Ticket`))) join `Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = `e`.`EsBulto`)))) where ((`t`.`Fecha` >= '2016-01-01') and (`t`.`empresa_id` in (442,567))) */; -/*!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_fallo` --- - -/*!50001 DROP VIEW IF EXISTS `v_fallo`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_fallo` AS select `vncontrol`.`fallo`.`queja_id` AS `queja_id`,`vncontrol`.`fallo`.`accion_id` AS `accion_id` from `vncontrol`.`fallo` */; -/*!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_inter` --- - -/*!50001 DROP VIEW IF EXISTS `v_inter`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_inter` AS select `vncontrol`.`inter`.`inter_id` AS `inter_id`,`vncontrol`.`inter`.`state_id` AS `state_id`,`vncontrol`.`inter`.`nota` AS `nota`,`vncontrol`.`inter`.`odbc_date` AS `odbc_date`,`vncontrol`.`inter`.`Id_Ticket` AS `Id_Ticket`,`vncontrol`.`inter`.`Id_Trabajador` AS `Id_Trabajador`,`vncontrol`.`inter`.`Id_Supervisor` AS `Id_supervisor` from `vncontrol`.`inter` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_jerarquia` --- - -/*!50001 DROP VIEW IF EXISTS `v_jerarquia`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_jerarquia` AS select `jerarquia`.`worker_id` AS `Id_Trabajador`,`jerarquia`.`boss_id` AS `boss_id` from `jerarquia` union all select distinct `jerarquia`.`boss_id` AS `Id_Trabajador`,`jerarquia`.`boss_id` AS `boss_id` from `jerarquia` */; -/*!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_location` --- - -/*!50001 DROP VIEW IF EXISTS `v_location`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_location` AS select `tl`.`longitude` AS `longitude`,`tl`.`latitude` AS `latitude`,`t`.`Id_Consigna` AS `Id_Consigna` from (`ticket_location` `tl` join `Tickets` `t` on((`t`.`Id_Ticket` = `tl`.`Id_Ticket`))) where (`t`.`Fecha` >= (curdate() + interval -(3) month)) group by `t`.`Id_Consigna` order by `t`.`Id_Ticket` 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 `v_mana_spellers` --- - -/*!50001 DROP VIEW IF EXISTS `v_mana_spellers`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_mana_spellers` AS select `bs`.`mana_spellers`.`Id_Trabajador` AS `Id_Trabajador`,`bs`.`mana_spellers`.`size` AS `size`,`bs`.`mana_spellers`.`used` AS `used` from `bs`.`mana_spellers` */; -/*!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_miriam` --- - -/*!50001 DROP VIEW IF EXISTS `v_miriam`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_miriam` AS select `M`.`Id_Article` AS `Id_Article`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,`T`.`Fecha` AS `Fecha`,`T`.`Id_Cliente` AS `Id_Cliente`,(((`M`.`Cantidad` * `M`.`Preu`) * (100 - `M`.`Descuento`)) / 100) AS `Importe` from (((`Tickets` `T` join `Movimientos` `M` on((`T`.`Id_Ticket` = `M`.`Id_Ticket`))) join `Articles` `A` on((`M`.`Id_Article` = `A`.`Id_Article`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) where ((`T`.`Fecha` >= '2011-01-01') and (`A`.`tipo_id` = 7)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_movimientos_log` --- - -/*!50001 DROP VIEW IF EXISTS `v_movimientos_log`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_movimientos_log` AS select `bi`.`movimientos_log`.`idmovimientos_log` AS `idmovimientos_log`,`bi`.`movimientos_log`.`Id_Movimiento` AS `Id_Movimiento`,`bi`.`movimientos_log`.`odbc_date` AS `odbc_date`,`bi`.`movimientos_log`.`Id_Trabajador` AS `Id_Trabajador`,`bi`.`movimientos_log`.`field_name` AS `field_name`,`bi`.`movimientos_log`.`new_value` AS `new_value` from `bi`.`movimientos_log` */; -/*!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_movimientos_mark` --- - -/*!50001 DROP VIEW IF EXISTS `v_movimientos_mark`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_movimientos_mark` AS select `Movimientos_mark`.`Id_Movimiento` AS `Id_Movimiento`,max(`Movimientos_mark`.`Id_Accion`) AS `Accion` from `Movimientos_mark` group by `Movimientos_mark`.`Id_Movimiento` having ((max(`Movimientos_mark`.`Id_Accion`) = '6') or (max(`Movimientos_mark`.`Id_Accion`) = '7')) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_pedidos_auto_preparados` --- - -/*!50001 DROP VIEW IF EXISTS `v_pedidos_auto_preparados`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_pedidos_auto_preparados` AS select `t`.`CodigoTrabajador` AS `CodigoTrabajador`,`i`.`Id_Ticket` AS `Id_Ticket`,`i`.`odbc_date` AS `Momento` from ((`vn2008`.`v_jerarquia` `j` left join `vn2008`.`v_inter` `i` on((`j`.`Id_Trabajador` = `i`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `j`.`Id_Trabajador`))) where (`i`.`state_id` = 20) */; -/*!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_pedidos_auto_preparadoskk` --- - -/*!50001 DROP VIEW IF EXISTS `v_pedidos_auto_preparadoskk`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_pedidos_auto_preparadoskk` AS select `t`.`CodigoTrabajador` AS `CodigoTrabajador`,`TK`.`Fecha` AS `Fecha`,`TK`.`Id_Ticket` AS `Id_Ticket`,`i`.`odbc_date` AS `Momento` from (((`vn2008`.`v_jerarquia` `j` left join `vn2008`.`v_inter` `i` on((`j`.`Id_Trabajador` = `i`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `j`.`Id_Trabajador`))) left join `vn2008`.`Tickets` `TK` on((`TK`.`Id_Ticket` = `i`.`Id_Ticket`))) where (`i`.`state_id` = 5) */; -/*!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_phonebook` --- - -/*!50001 DROP VIEW IF EXISTS `v_phonebook`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_phonebook` AS select `Clientes`.`id_cliente` AS `Id_Cliente`,replace(`Clientes`.`telefono`,' ','') AS `Telefono` from `Clientes` where (`Clientes`.`telefono` and `Clientes`.`activo`) union select `Clientes`.`id_cliente` AS `Id_Cliente`,replace(`Clientes`.`movil`,' ','') AS `Movil` from `Clientes` where (`Clientes`.`movil` and `Clientes`.`activo`) union select `Consignatarios`.`Id_cliente` AS `Id_Cliente`,replace(`Consignatarios`.`telefono`,' ','') AS `TRIM(telefono)` from (`Consignatarios` join `Clientes` `c` on((`Consignatarios`.`Id_cliente` = `c`.`id_cliente`))) where (`Consignatarios`.`telefono` and `c`.`activo`) union select `Consignatarios`.`Id_cliente` AS `Id_Cliente`,replace(`Consignatarios`.`movil`,' ','') AS `TRIM(movil)` from (`Consignatarios` join `Clientes` `c` on((`Consignatarios`.`Id_cliente` = `c`.`id_cliente`))) where (`Consignatarios`.`movil` and `c`.`activo`) union select `r`.`Id_Cliente` AS `Id_Cliente`,replace(`c`.`Telefono`,' ','') AS `REPLACE(c.telefono,' ','')` from ((`Clientes` `cl` join `Relaciones` `r` on((`cl`.`id_cliente` = `r`.`Id_Cliente`))) join `Contactos` `c` on((`r`.`Id_Contacto` = `c`.`Id_Contacto`))) where (`cl`.`telefono` and `cl`.`activo`) union select `r`.`Id_Cliente` AS `Id_Cliente`,replace(`c`.`Movil`,' ','') AS `REPLACE(c.Movil,' ','')` from ((`Clientes` `cl` join `Relaciones` `r` on((`cl`.`id_cliente` = `r`.`Id_Cliente`))) join `Contactos` `c` on((`r`.`Id_Contacto` = `c`.`Id_Contacto`))) where (`cl`.`movil` and `cl`.`activo`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_price_fixed` --- - -/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_price_fixed` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `price_fixed` `pf` where (`pf`.`warehouse_id` < 1000) union all select `wg`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from (`price_fixed` `pf` join `warehouse_group` `wg`) where ((`wg`.`warehouse_alias_id` + 1000) = `pf`.`warehouse_id`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_price_fixed_group` --- - -/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_price_fixed_group` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `v_price_fixed` `pf` group by `pf`.`warehouse_id`,`pf`.`item_id`,`pf`.`date_start`,`pf`.`date_end` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_session` --- - -/*!50001 DROP VIEW IF EXISTS `v_session`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_session` AS select 1 AS `id`,`t`.`CodigoTrabajador` AS `CodigoTrabajador`,if(isnull(`sc`.`Id_Suplente`),`c`.`Id_Trabajador`,`sc`.`Id_Suplente`) AS `Id_Trabajador`,`c`.`id_cliente` AS `Id_Cliente`,`c`.`cliente` AS `Cliente`,`s`.`lastUpdate` AS `Fecha` from ((((`hedera`.`userSession` `s` join `hedera`.`visitUser` `v` on((`v`.`id` = `s`.`userVisit`))) join `vn2008`.`Clientes` `c` on((`c`.`id_cliente` = `v`.`user`))) left join `vn2008`.`Trabajadores` `t` on((`c`.`Id_Trabajador` = `t`.`Id_Trabajador`))) left join `vn2008`.`sharingcart` `sc` on(((`sc`.`Id_Trabajador` = `c`.`Id_Trabajador`) and (curdate() between `sc`.`datSTART` and `sc`.`datEND`)))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_ticket_amount` --- - -/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ticket_amount` AS select `Movimientos`.`Id_Ticket` AS `Id_Ticket`,sum((((`Movimientos`.`Cantidad` * `Movimientos`.`Preu`) * (100 - `Movimientos`.`Descuento`)) / 100)) AS `amount` from (`Movimientos` join `Tickets` on((`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`))) where (`Tickets`.`Fecha` >= (curdate() + interval -(6) month)) group by `Movimientos`.`Id_Ticket` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_trabajadores` --- - -/*!50001 DROP VIEW IF EXISTS `v_trabajadores`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_trabajadores` AS select `t`.`CodigoTrabajador` AS `CodigoTrabajador`,`t`.`Nombre` AS `Nombre`,`t`.`Fecha_Inicio` AS `Fecha_Inicio`,`t`.`Password` AS `Password`,`t`.`user` AS `user`,`t`.`Apellidos` AS `Apellidos`,`t`.`Id_Trabajador` AS `Id_Trabajador`,`t`.`Foto` AS `Foto` from `vn2008`.`Trabajadores` `t` where (`t`.`Id_Cliente_Interno` = `account`.`userGetId`()) */; -/*!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_user` --- - -/*!50001 DROP VIEW IF EXISTS `v_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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_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` 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 `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 ((((((((`Movimientos` `M` join `Tickets` `T` on((`M`.`Id_Ticket` = `T`.`Id_Ticket`))) join `Consignatarios` `CS` on((`CS`.`id_consigna` = `T`.`Id_Consigna`))) join `Clientes` `C` on((`CS`.`Id_cliente` = `C`.`id_cliente`))) join `Articles` `A` on((`M`.`Id_Article` = `A`.`Id_Article`))) join `Origen` `O` on((`O`.`id` = `A`.`id_origen`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) join `reinos` `r` on((`TP`.`reino_id` = `r`.`id`))) join `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_venteskk` --- - -/*!50001 DROP VIEW IF EXISTS `v_venteskk`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_venteskk` 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 ((((((((`Movimientos` `M` join `Tickets` `T` on((`M`.`Id_Ticket` = `T`.`Id_Ticket`))) join `Consignatarios` `CS` on((`CS`.`id_consigna` = `T`.`Id_Consigna`))) join `Clientes` `C` on((`CS`.`Id_cliente` = `C`.`id_cliente`))) join `Articles` `A` on((`M`.`Id_Article` = `A`.`Id_Article`))) join `Origen` `O` on((`O`.`id` = `A`.`id_origen`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) join `reinos` `r` on((`TP`.`reino_id` = `r`.`id`))) join `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_warehouse` --- - -/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `warehouse` union all select (1000 + `warehouse_alias`.`warehouse_alias_id`) AS `warehouse_alias_id`,concat(`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `warehouse_alias` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubclien` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubclien` AS select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `Facturas` where (`Facturas`.`Fecha` > (curdate() + interval -(2) month)) union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `Recibos` where (`Recibos`.`Fechacobro` > (curdate() + interval -(2) month)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubcuentas` --- - -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,trim(`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`v_xsubclien`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,(coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1)) AS `EMAIL`,`Clientes`.`cplusTerIdNifFk` AS `IDNIF` from (((`Clientes` join `v_xsubclien` on((`Clientes`.`id_cliente` = `v_xsubclien`.`Id_Cliente`))) left join `Paises` `p` on((`p`.`Id` = `Clientes`.`Id_Pais`))) join `province` on((`Clientes`.`province_id` = `province`.`province_id`))) where (`Clientes`.`oficial` <> 0) group by `Clientes`.`id_cliente`,`v_xsubclien`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,trim(`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`CP` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,(coalesce(nullif(locate(',',`c`.`email`),0),99) - 1)) AS `EMAIL`,if((`p`.`CEE` = 0),1,if((`p`.`CEE` = 1),2,4)) AS `IDNIF` from (((((`Proveedores` join `v_xsubprov` on((`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`))) left join `Paises` `p` on((`p`.`Id` = `Proveedores`.`pais_id`))) left join `province` `prov` on((`prov`.`province_id` = `Proveedores`.`province_id`))) left join `Relaciones` `r` on((`r`.`Id_Proveedor` = `Proveedores`.`Id_Proveedor`))) left join `Contactos` `c` on((`c`.`Id_Contacto` = `r`.`Id_Contacto`))) where (`Proveedores`.`oficial` <> 0) group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` union all select `Gastos`.`Id_Gasto` AS `Id_Gasto`,`Gastos`.`Gasto` 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 (`Gastos` join `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 (`Bancos` join `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`.`CP` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,(coalesce(nullif(locate(',',`c`.`email`),0),99) - 1)) AS `EMAIL`,if((`p`.`CEE` = 0),1,if((`p`.`CEE` = 1),2,4)) AS `IDNIF` from (((((`Proveedores` join `v_xsubprov` on((`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`))) left join `Paises` `p` on((`p`.`Id` = `Proveedores`.`pais_id`))) left join `province` `prov` on((`prov`.`province_id` = `Proveedores`.`province_id`))) left join `Relaciones` `r` on((`r`.`Id_Proveedor` = `Proveedores`.`Id_Proveedor`))) left join `Contactos` `c` on((`c`.`Id_Contacto` = `r`.`Id_Contacto`))) where (((`Proveedores`.`cuenta` like '_____3____') or (`Proveedores`.`cuenta` like '_____2____')) and (`Proveedores`.`oficial` = 1)) group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubprov` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubprov` AS select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `recibida` where (`recibida`.`fecha` > (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 `pago` where (`pago`.`fecha` > (curdate() + interval -(3) month)) group by `pago`.`id_proveedor`,`pago`.`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 `vnCreditClassification` --- - -/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnCreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `client`,`vn`.`creditClassification`.`dateStart` AS `dateStart`,`vn`.`creditClassification`.`dateEnd` AS `dateEnd` from `vn`.`creditClassification` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `vnCreditInsurance` --- - -/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnCreditInsurance` AS select `vn`.`creditInsurance`.`id` AS `id`,`vn`.`creditInsurance`.`creditClassification` AS `creditClassification`,`vn`.`creditInsurance`.`credit` AS `credit`,`vn`.`creditInsurance`.`creationDate` AS `creationDate`,`vn`.`creditInsurance`.`grade` AS `grade` from `vn`.`creditInsurance` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `vnSolunionCAP` --- - -/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `vnSolunionCAP` AS select `vn`.`solunionCAP`.`creditInsurance` AS `creditInsurance`,`vn`.`solunionCAP`.`dateStart` AS `dateStart`,`vn`.`solunionCAP`.`dateEnd` AS `dateEnd`,`vn`.`solunionCAP`.`dateLeaving` AS `dateLeaving` from `vn`.`solunionCAP` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDocument` AS select `vn`.`workerDocument`.`id` AS `id`,`vn`.`workerDocument`.`worker` AS `worker`,`vn`.`workerDocument`.`document` AS `document` 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 `workerTeamCollegues` --- - -/*!50001 DROP VIEW IF EXISTS `workerTeamCollegues`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`Id_Trabajador` AS `workerId`,`t`.`Id_Trabajador` AS `collegueId` from (`vn`.`workerTeam` `w` join `vn`.`workerTeam` `t` on((`w`.`team` = `t`.`team`))) */; -/*!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_kk` --- - -/*!50001 DROP VIEW IF EXISTS `workerTeam_kk`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeam_kk` AS select `w`.`team` AS `team`,`w`.`user` AS `user`,`w`.`id` AS `id`,`t`.`Id_Trabajador` AS `Id_Trabajador` from (`vn`.`workerTeam` `w` left join `vn2008`.`Trabajadores` `t` on((`t`.`user_id` = `w`.`user`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Current Database: `bi` --- - -USE `bi`; - --- --- Final view structure for view `analisis_grafico_ventas` --- - -/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `analisis_grafico_ventas` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */; -/*!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 `analisis_ventas_simple` --- - -/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `analisis_ventas_simple` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */; -/*!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 `customerRiskOverdue` --- - -/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `customerRiskOverdue` AS select `cr`.`customer_id` AS `customer_id`,`cr`.`amount` AS `amount`,`cr`.`company_id` AS `company_id` from (((`bi`.`customer_risk` `cr` join `vn2008`.`empresa` `e` on((`e`.`id` = `cr`.`company_id`))) join `vn2008`.`Clientes` `c` on((`cr`.`customer_id` = `c`.`id_cliente`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where (`cr`.`amount` and `e`.`morosidad` and `pm`.`deudaviva`) union all select `f`.`Id_Cliente` AS `Id_Cliente`,-(round(`f`.`Importe`,2)) AS `importe`,`f`.`empresa_id` AS `empresa_id` from (((`vn2008`.`Facturas` `f` join `vn2008`.`Clientes` `c` on((`f`.`Id_Cliente` = `c`.`id_cliente`))) join `vn2008`.`empresa` `e` on((`e`.`id` = `f`.`empresa_id`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where ((`f`.`Fecha` > (curdate() + interval -(101) day)) and ((`vn2008`.`paymentday`(`f`.`Fecha`,`c`.`vencimiento`) + interval `pm`.`graceDays` day) > curdate()) and (`f`.`Importe` > 0) and `e`.`morosidad` and `pm`.`deudaviva`) */; -/*!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 `last_Id_Cubo` --- - -/*!50001 DROP VIEW IF EXISTS `last_Id_Cubo`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `last_Id_Cubo` AS select `C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Article` AS `Id_Article`,`tr`.`warehouse_id` AS `warehouse_id`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Packing` AS `Packing` from ((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on((`C`.`Id_Entrada` = `E`.`Id_Entrada`))) join `vn2008`.`travel` `tr` on((`E`.`travel_id` = `tr`.`id`))) where ((`C`.`Id_Cubo` is not null) and (`C`.`Id_Cubo` <> '--') and (`tr`.`landing` > (curdate() - interval 18 month))) order by `C`.`Id_Compra` 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 `v_clientes_jerarquia` --- - -/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_clientes_jerarquia` AS select `c`.`id_cliente` AS `Id_Cliente`,`c`.`cliente` AS `Cliente`,`t`.`CodigoTrabajador` AS `Comercial`,`tj`.`CodigoTrabajador` AS `Jefe` from (((`vn2008`.`Clientes` `c` join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `c`.`Id_Trabajador`))) join `vn2008`.`jerarquia` on((`vn2008`.`jerarquia`.`worker_id` = `c`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `tj` on((`tj`.`Id_Trabajador` = `vn2008`.`jerarquia`.`boss_id`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_ventas_contables` --- - -/*!50001 DROP VIEW IF EXISTS `v_ventas_contables`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ventas_contables` AS select `vn2008`.`time`.`year` AS `year`,`vn2008`.`time`.`month` AS `month`,cast(sum((((`m`.`Cantidad` * `m`.`Preu`) * (100 - `m`.`Descuento`)) / 100)) as decimal(10,0)) AS `importe` from (((`vn2008`.`Tickets` `t` join `bi`.`f_tvc` on((`t`.`Id_Ticket` = `bi`.`f_tvc`.`Id_Ticket`))) join `vn2008`.`Movimientos` `m` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) join `vn2008`.`time` on((`vn2008`.`time`.`date` = cast(`t`.`Fecha` as date)))) where (`t`.`Fecha` >= '2014-01-01') group by `vn2008`.`time`.`year`,`vn2008`.`time`.`month` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Current Database: `vn` --- - -USE `vn`; - --- --- Final view structure for view `accounting` --- - -/*!50001 DROP VIEW IF EXISTS `accounting`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `accounting` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `address` --- - -/*!50001 DROP VIEW IF EXISTS `address`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `address` AS select `cs`.`Id_cliente` AS `customer`,`cs`.`warehouse_id` AS `warehouse`,`cs`.`domicilio` AS `street`,`cs`.`poblacion` AS `city`,`cs`.`province_id` AS `province`,`cs`.`codPostal` AS `postalCode`,`cs`.`telefono` AS `phone`,`cs`.`movil` AS `celular`,`cs`.`consignatario` AS `nickname`,`cs`.`id_consigna` AS `id`,`cs`.`predeterminada` AS `defaultAddress`,`cs`.`Id_Agencia` AS `agency`,`cs`.`active` AS `active`,`cs`.`longitude` AS `longitude`,`cs`.`latitude` AS `latitude`,`cs`.`Id_cliente` AS `clientFk`,`cs`.`warehouse_id` AS `warehouseFk`,`cs`.`province_id` AS `provinceFk`,`cs`.`movil` AS `mobile`,`cs`.`Id_Agencia` AS `agencyFk`,`cs`.`isEqualizated` AS `isEqualizated` from `vn2008`.`Consignatarios` `cs` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `addressObservation` --- - -/*!50001 DROP VIEW IF EXISTS `addressObservation`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `addressObservation` AS select `co`.`consignatarios_observation_id` AS `id`,`co`.`Id_Consigna` AS `addressFk`,`co`.`observation_type_id` AS `observationTypeFk`,`co`.`text` AS `description` from `vn2008`.`consignatarios_observation` `co` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `agency` --- - -/*!50001 DROP VIEW IF EXISTS `agency`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `agency` AS select `a`.`agency_id` AS `id`,`a`.`name` AS `name`,`a`.`warehouse_id` AS `warehouse`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`por_volumen` AS `isVolumetric`,`a`.`Id_Banco` AS `bank`,`a`.`Id_Banco` AS `bankFk`,`a`.`warehouse_alias_id` AS `warehouseNickname`,`a`.`warehouse_alias_id` AS `warehouseAliasFk`,`a`.`propios` AS `own`,`a`.`zone_label` AS `labelZone` from `vn2008`.`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 `agencyHour` --- - -/*!50001 DROP VIEW IF EXISTS `agencyHour`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `agencyHour` AS select `h`.`agency_hour_id` AS `id`,`h`.`agency_id` AS `agency`,`h`.`week_day` AS `weekDay`,`h`.`warehouse_id` AS `warehouse`,`h`.`province_id` AS `province`,`h`.`subtract_day` AS `substractDay`,`h`.`max_hour` AS `maxHour` from `vn2008`.`agency_hour` `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 `agencyMode` --- - -/*!50001 DROP VIEW IF EXISTS `agencyMode`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `agencyMode` AS select `a`.`Id_Agencia` AS `id`,`a`.`Agencia` AS `name`,`a`.`description` AS `description`,`a`.`Vista` AS `view`,`a`.`Vista` AS `deliveryMethod`,`a`.`m3` AS `m3`,`a`.`cod71` AS `cod71`,`a`.`web` AS `web`,`a`.`agency_id` AS `agency`,`a`.`agency_id` AS `agencyFk`,`a`.`agency_service_id` AS `agencyService`,`a`.`agency_service_id` AS `agencyServiceFk`,`a`.`inflacion` AS `inflacion`,`a`.`is_volumetric` AS `isVolumetric`,`a`.`send_mail` AS `reportMail` from `vn2008`.`Agencias` `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 `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` 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 `awb` --- - -/*!50001 DROP VIEW IF EXISTS `awb`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `awb` AS select `a`.`id` AS `id`,`a`.`codigo` AS `code`,`a`.`bultos` AS `package`,`a`.`peso` AS `weight`,`a`.`MYSQL_TIME` AS `created`,`a`.`transitario_id` AS `transitoryFk`,`a`.`iva_id` AS `taxFk`,`a`.`gestdoc_id` AS `docFk`,`a`.`importe` AS `amount`,`a`.`carguera_id` AS `freightFk`,`a`.`m3` AS `m3`,`a`.`stems` AS `stems`,`a`.`flight_id` AS `flightFk`,`a`.`volume_weight` AS `volumeWeight`,`a`.`hb` AS `hb`,`a`.`rate` AS `rate`,`a`.`booked` AS `booked`,`a`.`issued` AS `issued`,`a`.`operated` AS `operated` from `vn2008`.`awb` `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 `bank` --- - -/*!50001 DROP VIEW IF EXISTS `bank`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `bank` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `cash`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `botanicExport` --- - -/*!50001 DROP VIEW IF EXISTS `botanicExport`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description` from `vn2008`.`botanic_export` `be` */; -/*!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` --- - -/*!50001 DROP VIEW IF EXISTS `buy`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `buy` AS select `c`.`Id_Compra` AS `id`,`c`.`Id_Entrada` AS `entryFk`,`c`.`Id_Article` AS `itemFk`,`c`.`Cantidad` AS `amount`,`c`.`Costefijo` AS `buyingValue`,`c`.`Cantidad` AS `quantity`,`c`.`Id_Cubo` AS `packageFk`,`c`.`Etiquetas` AS `stickers`,`c`.`Portefijo` AS `freightValue`,`c`.`Embalajefijo` AS `packageValue`,`c`.`Comisionfija` AS `comissionValue`,`c`.`Packing` AS `packing`,`c`.`grouping` AS `grouping`,`c`.`caja` AS `groupingMode`,`c`.`Nicho` AS `location`,`c`.`Tarifa1` AS `price1`,`c`.`Tarifa2` AS `price2`,`c`.`Tarifa3` AS `price3`,`c`.`PVP` AS `minPrice`,`c`.`Productor` AS `producer`,`c`.`Vida` AS `printedStickers`,`c`.`punteo` AS `isChecked` from `vn2008`.`Compres` `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 `city` --- - -/*!50001 DROP VIEW IF EXISTS `city`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `city` AS select `c`.`city_id` AS `id`,`c`.`name` AS `name`,`c`.`province_id` AS `provinceFk` from `vn2008`.`city` `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 `client` --- - -/*!50001 DROP VIEW IF EXISTS `client`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`telefono` AS `phone`,`c`.`fax` AS `fax`,`c`.`e-mail` AS `email`,`c`.`cc` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`Cuenta` AS `accountingAccount`,`c`.`RE` AS `isEqualizated`,`c`.`poblacion` AS `city`,`c`.`province_id` AS `province`,`c`.`province_id` AS `provinceFk`,`c`.`codPostal` AS `postcode`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`reexpedicion` AS `Reexpedicion`,`c`.`invoice` AS `hasToInvoice`,`c`.`notas` AS `Notas`,`c`.`notas_administracion` AS `notas_administracion`,`c`.`copiaFactura` AS `Copiafactura`,`c`.`retener` AS `Retener`,`c`.`congelado` AS `Congelado`,`c`.`Id_Trabajador` AS `Id_Trabajador`,`c`.`Id_Trabajador` AS `workerFk`,`c`.`credito` AS `credit`,`c`.`cyc` AS `cyc`,`c`.`Id_Pais` AS `Id_Pais`,`c`.`Id_Pais` AS `countryFk`,`c`.`activo` AS `activo`,`c`.`activo` AS `active`,`c`.`gestdoc_id` AS `gestdoc`,`c`.`gestdoc_id` AS `gestdocFk`,`c`.`calidad` AS `calidad`,`c`.`pay_met_id` AS `paymentMethod`,`c`.`pay_met_id` AS `paymentMethodFk`,`c`.`created` AS `registerDate`,`c`.`mail` AS `invoiceByEmail`,`c`.`mail` AS `isToBeMailed`,`c`.`chanel_id` AS `channel`,`c`.`chanel_id` AS `channelFk`,`c`.`vies` AS `VIES`,`c`.`sepaVnl` AS `sepavnl`,`c`.`coreVnl` AS `corevnl`,`c`.`risk_calculated` AS `riskCalculated`,`c`.`coreVnh` AS `corevnh`,`c`.`clientes_tipo_id` AS `clientes_tipo_id`,`c`.`clientes_tipo_id` AS `clientTypeFk`,`c`.`postcode_id` AS `postcode_id`,`c`.`postcode_id` AS `postcodeFk`,`c`.`mail_address` AS `mail_address`,`c`.`codpos` AS `codpos`,`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,`c`.`domicilio` AS `postalAddress`,`c`.`invoiceByAddress` AS `invoiceByAddress`,`c`.`contabilizado` AS `isTaxDataChecked`,`c`.`congelado` AS `isFreezed` from `vn2008`.`Clientes` `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 `clientManaCache` --- - -/*!50001 DROP VIEW IF EXISTS `clientManaCache`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientManaCache` AS select `mc`.`Id_Cliente` AS `clientFk`,`mc`.`Mana` AS `mana`,`mc`.`dated` AS `dated` from `bs`.`manaCustomer` `mc` */; -/*!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 `clientObservation` --- - -/*!50001 DROP VIEW IF EXISTS `clientObservation`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientObservation` AS select `vn2008`.`client_observation`.`client_observation_id` AS `id`,`vn2008`.`client_observation`.`Id_Cliente` AS `client`,`vn2008`.`client_observation`.`Id_Trabajador` AS `worker`,`vn2008`.`client_observation`.`text` AS `text`,`vn2008`.`client_observation`.`odbc_date` AS `creationDate` from `vn2008`.`client_observation` */; -/*!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 `clientType` --- - -/*!50001 DROP VIEW IF EXISTS `clientType`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type` from `vn2008`.`clientes_tipo` `ct` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `company` --- - -/*!50001 DROP VIEW IF EXISTS `company`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `company` AS select `e`.`id` AS `id`,`e`.`abbreviation` AS `code` from `vn2008`.`empresa` `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 `country` --- - -/*!50001 DROP VIEW IF EXISTS `country`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `country` AS select `p`.`Id` AS `id`,`p`.`Pais` AS `country`,`p`.`CEE` AS `CEE`,if((`p`.`CEE` < 2),1,0) AS `isUeeMember`,`p`.`Codigo` AS `Code`,`p`.`Id_Moneda` AS `currencyFk`,`p`.`Id_Paisreal` AS `politicalCountryFk`,`p`.`geoFk` AS `geoFk` from `vn2008`.`Paises` `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 `deliveryMethod` --- - -/*!50001 DROP VIEW IF EXISTS `deliveryMethod`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `deliveryMethod` AS select `d`.`vista_id` AS `id`,`d`.`code` AS `code`,`d`.`vista` AS `description` from `vn2008`.`Vistas` `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 `ediGenus` --- - -/*!50001 DROP VIEW IF EXISTS `ediGenus`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ediGenus` AS select `g`.`genus_id` AS `id`,`g`.`latin_genus_name` AS `latinGenusName`,`g`.`entry_date` AS `entried`,`g`.`expiry_date` AS `dued`,`g`.`change_date_time` AS `modified` from `edi`.`genus` `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 `ediSpecie` --- - -/*!50001 DROP VIEW IF EXISTS `ediSpecie`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ediSpecie` AS select `s`.`specie_id` AS `id`,`s`.`genus_id` AS `genusFk`,`s`.`latin_species_name` AS `latinSpeciesName`,`s`.`entry_date` AS `entried`,`s`.`expiry_date` AS `dued`,`s`.`change_date_time` AS `modified` from `edi`.`specie` `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 `entry` --- - -/*!50001 DROP VIEW IF EXISTS `entry`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `entry` AS select `e`.`Id_Entrada` AS `id`,`e`.`Id_Proveedor` AS `supplierFk`,`e`.`Referencia` AS `ref`,`e`.`Inventario` AS `isInventory`,`e`.`Confirmada` AS `isConfirmed`,`e`.`Pedida` AS `isOrdered`,`e`.`Redada` AS `isRaid`,`e`.`comision` AS `commission`,`e`.`odbc_date` AS `created`,`e`.`Notas_Eva` AS `evaNotes`,`e`.`travel_id` AS `travelFk`,`e`.`Id_Moneda` AS `currencyFk`,`e`.`empresa_id` AS `companyFk`,`e`.`gestdoc_id` AS `gestDocFk`,`e`.`recibida_id` AS `invoiceReceivedFk` from `vn2008`.`Entradas` `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 `especialPrice` --- - -/*!50001 DROP VIEW IF EXISTS `especialPrice`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `especialPrice` AS select `p`.`Id_PrecioEspecial` AS `id`,`p`.`Id_Cliente` AS `clientFk`,`p`.`Id_Article` AS `itemFk`,`p`.`PrecioEspecial` AS `value` from `vn2008`.`PreciosEspeciales` `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 `expedition` --- - -/*!50001 DROP VIEW IF EXISTS `expedition`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `expedition` AS select `e`.`expeditions_id` AS `id`,`e`.`agency_id` AS `agency`,`e`.`agency_id` AS `agencyFk`,`e`.`ticket_id` AS `ticket`,`e`.`ticket_id` AS `ticketFk`,`e`.`EsBulto` AS `isBox`,`e`.`odbc_date` AS `printingTime`,`e`.`Id_Article` AS `item`,`e`.`Id_Article` AS `itemFk`,`e`.`counter` AS `counter`,`e`.`checked` AS `checked`,`e`.`workerFk` AS `workerFk` from `vn2008`.`expeditions` `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 `expence` --- - -/*!50001 DROP VIEW IF EXISTS `expence`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `expence` AS select `g`.`Id_Gasto` AS `id`,`g`.`iva_tipo_id` AS `taxTypeFk`,`g`.`Gasto` AS `name`,`g`.`isWithheld` AS `isWithheld` from `vn2008`.`Gastos` `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 `family` --- - -/*!50001 DROP VIEW IF EXISTS `family`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `family` AS select `t`.`tipo_id` AS `id`,`t`.`Tipo` AS `name`,`t`.`life` AS `life` from `vn2008`.`Tipos` `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 `grant` --- - -/*!50001 DROP VIEW IF EXISTS `grant`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `grant` AS select `vn2008`.`Permisos`.`Id_Grupo` AS `group`,`vn2008`.`Permisos`.`Id_Trabajador` AS `worker`,`vn2008`.`Permisos`.`empresa_id` AS `company` from `vn2008`.`Permisos` */; -/*!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 `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `grantGroup` AS select `vn2008`.`Grupos`.`id` AS `id`,`vn2008`.`Grupos`.`Grupo` AS `description`,`vn2008`.`Grupos`.`observation_type_id` AS `observationType` 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 `ink` --- - -/*!50001 DROP VIEW IF EXISTS `ink`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ink` AS select `c`.`Id_Tinta` AS `id`,`c`.`name` AS `name`,`c`.`Tinta` AS `picture` from `vn2008`.`Tintas` `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 `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `intrastat` AS select `i`.`Codintrastat` AS `id`,`i`.`Definicion` AS `description`,`i`.`iva_group_id` AS `taxGroupFk`,`i`.`iva_codigo_id` AS `taxCodeFk` from `vn2008`.`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 `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceCorrection` AS select `ic`.`correctingFk` AS `correctingFk`,`ic`.`correctedFk` AS `correctedFk`,`ic`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`ic`.`cplusInvoiceType477Fk` AS `cplusInvoiceType477Fk`,`ic`.`invoiceCorrectionTypeFk` AS `invoiceCorrectionTypeFk` from `vn2008`.`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 `invoiceCorrectionDataSource` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceCorrectionDataSource`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceCorrectionDataSource` AS select `s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`s`.`price` AS `price`,`s`.`discount` AS `discount`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk` from (`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) */; -/*!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 `invoiceIn` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceIn`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceIn` AS select `r`.`id` AS `id`,`r`.`num_recibida` AS `serialNumber`,`r`.`serie` AS `serial`,`r`.`proveedor_id` AS `supplierFk`,`r`.`fecha` AS `issued`,`r`.`sref` AS `supplierRef`,`r`.`contabilizada` AS `isBooked`,`r`.`moneda_id` AS `currencyFk`,`r`.`MYSQL_TIME` AS `created`,`r`.`empresa_id` AS `companyFk`,`r`.`gestdoc_id` AS `docFk`,`r`.`dateBooking` AS `booked`,`r`.`dateOperation` AS `operated`,`r`.`cplusInvoiceType472Fk` AS `cplusInvoiceType472Fk`,`r`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`r`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`r`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`r`.`cplusTrascendency472Fk` AS `cplusTrascendency472Fk` from `vn2008`.`recibida` `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 `invoiceInAwb` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceInAwb`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInAwb` AS select `a`.`recibida_id` AS `invoiceInFk`,`a`.`awb_id` AS `awbFk`,`a`.`dua` AS `dua` from `vn2008`.`awb_recibida` `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 `invoiceInEntry` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceInEntry`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInEntry` AS select `i`.`recibida_entrada_id` AS `id`,`i`.`recibida_id` AS `invoiceInFk`,`i`.`Id_Entrada` AS `entryFk`,`i`.`percentage` AS `percentage`,`i`.`awb_recibida` AS `invoiceInAwbFk`,`i`.`Contabilizado` AS `isBooked` from `vn2008`.`recibida_entrada` `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 `invoiceInIntrastat` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInIntrastat` AS select `r`.`recibida_id` AS `invoiceInFk`,`r`.`Codintrastat` AS `intrastatFk`,`r`.`importe` AS `amount` from `vn2008`.`recibida_intrastat` `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 `invoiceInTax` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceInTax`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInTax` AS select `r`.`id` AS `id`,`r`.`recibida_id` AS `invoiceInFk`,`r`.`iva_id` AS `taxCodeFk`,`r`.`bi` AS `taxableBase`,`r`.`gastos_id` AS `expenceFk`,`r`.`divisa` AS `foreignValue`,`r`.`MYSQL_TIME` AS `created` from `vn2008`.`recibida_iva` `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 `invoiceOut` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceOut`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceOut` AS select `f`.`factura_id` AS `id`,`f`.`Id_Factura` AS `ref`,`f`.`Serie` AS `serial`,`f`.`Fecha` AS `issued`,`f`.`Importe` AS `amount`,`f`.`Id_Cliente` AS `clientFk`,`f`.`odbc_date` AS `created`,`f`.`empresa_id` AS `companyFk`,`f`.`Vencimiento` AS `dued`,`f`.`booked` AS `booked`,`f`.`cplusInvoiceType477Fk` AS `cplusInvoiceType477Fk`,`f`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`f`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`f`.`cplusTrascendency477Fk` AS `cplusTrascendency477Fk`,`f`.`pdf` AS `pdf` from `vn2008`.`Facturas` `f` */; -/*!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` --- - -/*!50001 DROP VIEW IF EXISTS `item`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `item` AS select `t`.`Id_Article` AS `id`,`t`.`Article` AS `name`,`t`.`tipo_id` AS `familyFk`,`t`.`Medida` AS `size`,`t`.`Color` AS `inkFk`,`t`.`Categoria` AS `category`,`t`.`Tallos` AS `stems`,`t`.`id_origen` AS `originFk`,`t`.`description` AS `description`,`t`.`producer_id` AS `producerFk`,`t`.`Codintrastat` AS `intrastatFk`,`t`.`expenceFk` AS `expenceFk` from `vn2008`.`Articles` `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 `itemBotanical` --- - -/*!50001 DROP VIEW IF EXISTS `itemBotanical`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemBotanical` AS select `ab`.`Id_Article` AS `itemFk`,`ab`.`botanical` AS `botanical`,`ab`.`genus_id` AS `genusFk`,`ab`.`specie_id` AS `specieFk` from `vn2008`.`Articles_botanical` `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 `itemBotanicalWithGenus` --- - -/*!50001 DROP VIEW IF EXISTS `itemBotanicalWithGenus`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,ifnull(`ib`.`botanical`,concat(`g`.`latinGenusName`,' ',ifnull(`s`.`latinSpeciesName`,''))) AS `ediBotanic` from ((`vn`.`itemBotanical` `ib` left join `vn`.`ediGenus` `g` on((`g`.`id` = `ib`.`genusFk`))) left join `vn`.`ediSpecie` `s` on((`s`.`id` = `ib`.`specieFk`))) */; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTag` AS select `t`.`id` AS `id`,`t`.`itemFk` AS `itemFk`,`t`.`tagFk` AS `tagFk`,`t`.`value` AS `value`,`t`.`priority` AS `priority` from `vn2008`.`itemTag` `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 `itemTagged` --- - -/*!50001 DROP VIEW IF EXISTS `itemTagged`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTagged` AS select distinct `itemTag`.`itemFk` AS `itemFk` from `vn`.`itemTag` */; -/*!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` --- - -/*!50001 DROP VIEW IF EXISTS `mail`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mail` AS select `vn2008`.`mail`.`id` AS `id`,`vn2008`.`mail`.`senderFk` AS `senderFk`,`vn2008`.`mail`.`recipientFk` AS `recipientFk`,`vn2008`.`mail`.`to` AS `sender`,`vn2008`.`mail`.`reply_to` AS `replyTo`,`vn2008`.`mail`.`subject` AS `subject`,`vn2008`.`mail`.`text` AS `body`,`vn2008`.`mail`.`plainTextBody` AS `plainTextBody`,`vn2008`.`mail`.`path` AS `attachment`,`vn2008`.`mail`.`DATE_ODBC` AS `creationDate`,`vn2008`.`mail`.`sent` AS `sent`,`vn2008`.`mail`.`error` AS `status` from `vn2008`.`mail` */; -/*!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 `manaSpellers` --- - -/*!50001 DROP VIEW IF EXISTS `manaSpellers`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `manaSpellers` AS select `bs`.`mana_spellers`.`Id_Trabajador` AS `worker`,`bs`.`mana_spellers`.`size` AS `size`,`bs`.`mana_spellers`.`used` AS `used`,`bs`.`mana_spellers`.`prices_modifier_rate` AS `pricesModifierRate`,`bs`.`mana_spellers`.`prices_modifier_activated` AS `pricesModifierActivated`,`vn2008`.`Trabajadores`.`CodigoTrabajador` AS `workerCode`,`vn2008`.`Trabajadores`.`Nombre` AS `firstname`,`vn2008`.`Trabajadores`.`Apellidos` AS `name` from (`bs`.`mana_spellers` join `vn2008`.`Trabajadores` on((`bs`.`mana_spellers`.`Id_Trabajador` = `vn2008`.`Trabajadores`.`Id_Trabajador`))) */; -/*!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 `movement` --- - -/*!50001 DROP VIEW IF EXISTS `movement`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `movement` AS select `m`.`Id_Movimiento` AS `id`,`m`.`Id_Article` AS `item`,`m`.`Id_Ticket` AS `ticket`,`m`.`Concepte` AS `concept`,`m`.`Cantidad` AS `amount`,`m`.`quantity` AS `quantity`,`m`.`Preu` AS `price`,`m`.`Descuento` AS `discount`,`m`.`CostFixat` AS `cost`,`m`.`Reservado` AS `reservado`,`m`.`OK` AS `od`,`m`.`PrecioFijado` AS `priceFixed`,`m`.`odbc_date` AS `lastUpdate` from `vn2008`.`Movimientos` `m` */; -/*!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 `observationType` --- - -/*!50001 DROP VIEW IF EXISTS `observationType`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `observationType` AS select `ot`.`observation_type_id` AS `id`,`ot`.`description` AS `description` from `vn2008`.`observation_type` `ot` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `origin` --- - -/*!50001 DROP VIEW IF EXISTS `origin`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `origin` AS select `o`.`id` AS `id`,`o`.`Abreviatura` AS `code`,`o`.`Origen` AS `name` from `vn2008`.`Origen` `o` */; -/*!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 `outgoingInvoice` --- - -/*!50001 DROP VIEW IF EXISTS `outgoingInvoice`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `outgoingInvoice` AS select `vn2008`.`Facturas`.`Id_Factura` AS `id`,`vn2008`.`Facturas`.`Serie` AS `serie`,`vn2008`.`Facturas`.`Fecha` AS `dateInvoice`,`vn2008`.`Facturas`.`Importe` AS `total`,`vn2008`.`Facturas`.`Vencimiento` AS `dueDate`,`vn2008`.`Facturas`.`Id_Banco` AS `bank`,`vn2008`.`Facturas`.`Id_Cliente` AS `client`,`vn2008`.`Facturas`.`Id_Remesa` AS `remittance`,`vn2008`.`Facturas`.`Remesar` AS `remit`,`vn2008`.`Facturas`.`Id_Trabajador` AS `worker`,`vn2008`.`Facturas`.`odbc_date` AS `creationDate`,`vn2008`.`Facturas`.`empresa_id` AS `company`,`vn2008`.`Facturas`.`liquidacion` AS `liquidacion?`,`vn2008`.`Facturas`.`pdf` AS `isPdf` from `vn2008`.`Facturas` */; -/*!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 `package` --- - -/*!50001 DROP VIEW IF EXISTS `package`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `package` AS select `c`.`Id_Cubo` AS `id`,`c`.`Volumen` AS `volume`,`c`.`X` AS `width`,`c`.`Y` AS `height`,`c`.`Z` AS `depth`,`c`.`Retornable` AS `isPackageReturnable`,`c`.`odbc_date` AS `created`,`c`.`item_id` AS `itemFk` from `vn2008`.`Cubos` `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 `payMethod` --- - -/*!50001 DROP VIEW IF EXISTS `payMethod`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `payMethod` AS select `pm`.`id` AS `id`,`pm`.`name` AS `name` from `vn2008`.`pay_met` `pm` */; -/*!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` --- - -/*!50001 DROP VIEW IF EXISTS `plantpassport`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `plantpassport` AS select `pp`.`producer_id` AS `producerFk`,`pp`.`plantpassport_authority_id` AS `plantpassportAuthorityFk`,`pp`.`number` AS `number` from `vn2008`.`plantpassport` `pp` */; -/*!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 `plantpassportAuthority` --- - -/*!50001 DROP VIEW IF EXISTS `plantpassportAuthority`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `plantpassportAuthority` AS select `ppa`.`plantpassport_authority_id` AS `id`,`ppa`.`denomination` AS `denomination`,`ppa`.`Paises_Id` AS `countryFk` from `vn2008`.`plantpassport_authority` `ppa` */; -/*!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 `priceFixed` --- - -/*!50001 DROP VIEW IF EXISTS `priceFixed`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `priceFixed` AS select `p`.`item_id` AS `itemFk`,`p`.`rate_0` AS `rate0`,`p`.`rate_1` AS `rate1`,`p`.`rate_2` AS `rate2`,`p`.`rate_3` AS `rate3`,`p`.`date_start` AS `started`,`p`.`date_end` AS `ended`,`p`.`bonus` AS `bonus`,`p`.`warehouse_id` AS `warehouseFk`,`p`.`odbc_date` AS `created`,`p`.`price_fixed_id` AS `id`,`p`.`grouping` AS `grouping`,`p`.`Packing` AS `packing`,`p`.`caja` AS `box` from `vn2008`.`price_fixed` `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 `printServerQueue` --- - -/*!50001 DROP VIEW IF EXISTS `printServerQueue`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `printServerQueue` AS select `c`.`Id_Cola` AS `id`,`c`.`Id_Impresora` AS `printerFk`,`c`.`Id_Prioridad` AS `priorityFk`,`c`.`Id_Informe` AS `reportFk`,`c`.`Id_Estado` AS `statusFk`,`c`.`Hora_Inicio` AS `started`,`c`.`Hora_Fin` AS `finished`,`c`.`Cola` AS `param1`,`c`.`Id_Trabajador` AS `workerFk`,`c`.`Cola2` AS `param2`,`c`.`Cola3` AS `param3`,`c`.`error` AS `error` from `vn2008`.`Colas` `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 `printingQueue` --- - -/*!50001 DROP VIEW IF EXISTS `printingQueue`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `printingQueue` AS select `c`.`Id_Cola` AS `id`,`c`.`Id_Impresora` AS `printer`,`c`.`Id_Prioridad` AS `priority`,`c`.`Id_Informe` AS `report`,`c`.`Id_Estado` AS `state`,`c`.`Hora_Inicio` AS `startingTime`,`c`.`Hora_Fin` AS `endingTime`,`c`.`Cola` AS `text`,`c`.`Id_Trabajador` AS `worker`,`c`.`Cola2` AS `text2`,`c`.`Cola3` AS `text3` from `vn2008`.`Colas` `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 `producer` --- - -/*!50001 DROP VIEW IF EXISTS `producer`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `producer` AS select `p`.`producer_id` AS `id`,`p`.`name` AS `name` from `vn2008`.`producer` `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 `province` --- - -/*!50001 DROP VIEW IF EXISTS `province`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `province` AS select `t`.`province_id` AS `id`,`t`.`name` AS `name`,`t`.`Paises_Id` AS `countryFk` from `vn2008`.`province` `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 `referenceRate` --- - -/*!50001 DROP VIEW IF EXISTS `referenceRate`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `referenceRate` AS select `r`.`moneda_id` AS `currencyFk`,`r`.`date` AS `dated`,`r`.`rate` AS `value` from `vn2008`.`reference_rate` `r` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `role` --- - -/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `role` AS select `account`.`role`.`id` AS `id`,`account`.`role`.`name` AS `name`,`account`.`role`.`description` AS `description`,`account`.`role`.`hasLogin` AS `hasLogin` from `account`.`role` */; -/*!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 `route` --- - -/*!50001 DROP VIEW IF EXISTS `route`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `route` AS select `a`.`Id_Ruta` AS `id`,`a`.`Id_Trabajador` AS `workerFk`,`a`.`Fecha` AS `created`,`a`.`Id_Vehiculo` AS `vehicleFk`,`a`.`Id_Agencia` AS `agencyFk`,`a`.`Id_Agencia` AS `agencyModeFk`,`a`.`Hora` AS `time`,`a`.`ok` AS `isOk`,`a`.`km_start` AS `kmStart`,`a`.`km_end` AS `kmEnd`,`a`.`date_start` AS `started`,`a`.`date_end` AS `finished`,`a`.`gestdoc_id` AS `gestdocFk`,`a`.`cost` AS `cost`,`a`.`m3` AS `m3` from `vn2008`.`Rutas` `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 `sale` --- - -/*!50001 DROP VIEW IF EXISTS `sale`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `sale` AS select `m`.`Id_Movimiento` AS `id`,`m`.`Id_Article` AS `itemFk`,`m`.`Id_Ticket` AS `ticketFk`,`m`.`Concepte` AS `concept`,`m`.`Cantidad` AS `quantity`,`m`.`Preu` AS `price`,`m`.`Descuento` AS `discount`,`m`.`Reservado` AS `reserved`,`m`.`OK` AS `isPicked`,`m`.`odbc_date` AS `created` from `vn2008`.`Movimientos` `m` */; -/*!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 `saleComponent` --- - -/*!50001 DROP VIEW IF EXISTS `saleComponent`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleComponent` AS select `mc`.`Id_Movimiento` AS `saleFk`,`mc`.`Id_Componente` AS `componentFk`,`mc`.`Valor` AS `value` from `vn2008`.`Movimientos_componentes` `mc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `state` --- - -/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `state` AS select `s`.`id` AS `id`,`s`.`name` AS `name`,`s`.`order` AS `order`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code` from `vn2008`.`state` `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 `supplier` --- - -/*!50001 DROP VIEW IF EXISTS `supplier`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `supplier` AS select `p`.`Id_Proveedor` AS `id`,`p`.`Proveedor` AS `name`,`p`.`cuenta` AS `account`,`p`.`pais_id` AS `countryFk`,`p`.`NIF` AS `nif`,`p`.`Agricola` AS `isFarmer`,`p`.`cuentaret` AS `retAccount`,`p`.`ComisionProveedor` AS `commission`,`p`.`odbc_time` AS `created`,`p`.`postcode_id` AS `postcodeFk`,`p`.`active` AS `isActive` from `vn2008`.`Proveedores` `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 `tag` --- - -/*!50001 DROP VIEW IF EXISTS `tag`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `tag` AS select `t`.`id` AS `id`,`t`.`name` AS `name`,`t`.`free` AS `free` from `vn2008`.`tag` `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 `taxClass` --- - -/*!50001 DROP VIEW IF EXISTS `taxClass`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `taxClass` AS select `c`.`iva_group_id` AS `id`,`c`.`description` AS `description`,`c`.`code` AS `code` from `vn2008`.`iva_group` `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 `taxClassCode` --- - -/*!50001 DROP VIEW IF EXISTS `taxClassCode`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `taxClassCode` AS select `c`.`iva_group_id` AS `taxClassFk`,`c`.`date` AS `effectived`,`c`.`iva_codigo_id` AS `taxCodeFk` from `vn2008`.`iva_group_codigo` `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 `taxCode` --- - -/*!50001 DROP VIEW IF EXISTS `taxCode`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `taxCode` AS select `ic`.`id` AS `id`,`ic`.`fecha` AS `dated`,`ic`.`codigo` AS `code`,`ic`.`iva_tipo_id` AS `taxTypeFk`,`ic`.`iva` AS `rate`,`ic`.`recargo` AS `equalizationTax`,`ic`.`tipo` AS `type`,`ic`.`link` AS `linkFk`,`ic`.`isActive` AS `isActive` from `vn2008`.`iva_codigo` `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 `taxType` --- - -/*!50001 DROP VIEW IF EXISTS `taxType`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `taxType` AS select `t`.`id` AS `id`,`t`.`alias` AS `nickname`,`t`.`serie_id` AS `serial`,`t`.`TIPOOPE` AS `TIPOOPE`,`t`.`descripcion` AS `description`,`t`.`Id_Pais` AS `countryFk` from `vn2008`.`iva_tipo` `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 `ticket` --- - -/*!50001 DROP VIEW IF EXISTS `ticket`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticket` AS select `t`.`Id_Ticket` AS `id`,`t`.`Id_Cliente` AS `clientFk`,`t`.`warehouse_id` AS `warehouseFk`,`t`.`Fecha` AS `shipped`,`t`.`landing` AS `landed`,`t`.`Alias` AS `nickname`,`t`.`Factura` AS `refFk`,`t`.`Id_Consigna` AS `addressFk`,`t`.`Firmado` AS `isSigned`,`t`.`Localizacion` AS `location`,`t`.`blocked` AS `blocked`,`t`.`Solucion` AS `solution`,`t`.`Id_Ruta` AS `path`,`t`.`Id_Ruta` AS `routeFk`,`t`.`empresa_id` AS `company`,`t`.`empresa_id` AS `companyFk`,`t`.`Id_Agencia` AS `agencyModeFk`,`t`.`Prioridad` AS `loadingOrder`,`t`.`odbc_date` AS `created`,`t`.`Fecha` AS `shipment`,`t`.`landing` AS `landing`,`t`.`Id_Cliente` AS `customer`,`t`.`warehouse_id` AS `warehouse`,`t`.`Id_Cliente` AS `client`,`t`.`Id_Consigna` AS `address`,`t`.`Id_Agencia` AS `agencyMode`,`t`.`Firmado` AS `signed`,`t`.`odbc_date` AS `creationDate` from `vn2008`.`Tickets` `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 `ticketObservation` --- - -/*!50001 DROP VIEW IF EXISTS `ticketObservation`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketObservation` AS select `to`.`ticket_observation_id` AS `id`,`to`.`Id_Ticket` AS `ticketFk`,`to`.`observation_type_id` AS `observationTypeFk`,`to`.`text` AS `description` from `vn2008`.`ticket_observation` `to` */; -/*!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 `ticketState` --- - -/*!50001 DROP VIEW IF EXISTS `ticketState`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketState` AS select `ts`.`Id_Ticket` AS `ticketFk`,`ts`.`Id_Ticket` AS `ticket`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code`,`i`.`Id_Trabajador` AS `worker`,`i`.`Id_Trabajador` AS `workerFk` from ((`vn2008`.`Tickets_state` `ts` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `ts`.`inter_id`))) join `vn2008`.`state` `s` on((`s`.`id` = `i`.`state_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 `ticketStateToday` --- - -/*!50001 DROP VIEW IF EXISTS `ticketStateToday`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticket` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`worker` AS `worker`,`ts`.`code` AS `code` from (`vn`.`ticketState` `ts` join `vn`.`ticket` `t` on((`t`.`id` = `ts`.`ticket`))) where (`t`.`shipment` between curdate() and `midnight`(curdate())) */; -/*!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 `ticketTracking` --- - -/*!50001 DROP VIEW IF EXISTS `ticketTracking`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketTracking` AS select `i`.`inter_id` AS `id`,`i`.`state_id` AS `stateFk`,`i`.`odbc_date` AS `created`,`i`.`Id_Ticket` AS `ticketFk`,`i`.`Id_Trabajador` AS `workerFk` from `vncontrol`.`inter` `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 `time` --- - -/*!50001 DROP VIEW IF EXISTS `time`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `time` AS select `t`.`date` AS `dated`,`t`.`period` AS `period`,`t`.`month` AS `month`,`t`.`year` AS `year`,`t`.`day` AS `day`,`t`.`week` AS `week` from `vn2008`.`time` `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 `travel` --- - -/*!50001 DROP VIEW IF EXISTS `travel`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `travel` AS select `t`.`id` AS `id`,`t`.`shipment` AS `shipped`,`t`.`shipment_hour` AS `shipmentHour`,`t`.`landing` AS `landed`,`t`.`landing_hour` AS `landingHour`,`t`.`warehouse_id` AS `warehouseInFk`,`t`.`warehouse_id_out` AS `warehouseOutFk`,`t`.`agency_id` AS `agencyFk`,`t`.`ref` AS `ref`,`t`.`delivered` AS `isDelivered`,`t`.`received` AS `isReceived`,`t`.`m3` AS `m3` from `vn2008`.`travel` `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 `unary` --- - -/*!50001 DROP VIEW IF EXISTS `unary`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `unary` AS select `a`.`id` AS `id`,`a`.`parent` AS `parent` from `vn2008`.`unary` `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 `unaryScan` --- - -/*!50001 DROP VIEW IF EXISTS `unaryScan`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `unaryScan` AS select `u`.`unary_id` AS `unaryFk`,`u`.`name` AS `name`,`u`.`odbc_date` AS `created`,`u`.`type` AS `type` from `vn2008`.`unary_scan` `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 `unaryScanLine` --- - -/*!50001 DROP VIEW IF EXISTS `unaryScanLine`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `unaryScanLine` AS select `u`.`id` AS `id`,`u`.`code` AS `code`,`u`.`odbc_date` AS `created`,`u`.`unary_id` AS `unaryScanFk` from `vn2008`.`unary_scan_line` `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 `unaryScanLineBuy` --- - -/*!50001 DROP VIEW IF EXISTS `unaryScanLineBuy`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `unaryScanLineBuy` AS select `u`.`scan_line_id` AS `unaryScanLineFk`,`u`.`Id_Article` AS `itemFk` from `vn2008`.`unary_scan_line_buy` `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 `unaryScanLineExpedition` --- - -/*!50001 DROP VIEW IF EXISTS `unaryScanLineExpedition`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `unaryScanLineExpedition` AS select `u`.`scan_line_id` AS `unaryScanLineFk`,`u`.`expedition_id` AS `expeditionFk` from `vn2008`.`unary_scan_line_expedition` `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 `user` --- - -/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `user` AS select `account`.`user`.`id` AS `id`,`account`.`user`.`name` AS `name`,`account`.`user`.`password` AS `password`,`account`.`user`.`role` AS `role`,`account`.`user`.`active` AS `active`,`account`.`user`.`recoverPass` AS `recoverPass`,`account`.`user`.`lastPassChange` AS `lastPassChange` from `account`.`user` */; -/*!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 `vehicle` --- - -/*!50001 DROP VIEW IF EXISTS `vehicle`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `vehicle` AS select `v`.`Id_Vehiculo` AS `id`,`v`.`Matricula` AS `numberPlate`,`v`.`Marca` AS `tradeMark`,`v`.`Modelo` AS `model`,`v`.`empresa_id` AS `companyFk`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`active` AS `isActive` from `vn2008`.`Vehiculos` `v` */; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouse` AS select `t`.`id` AS `id`,`t`.`name` AS `name`,`t`.`inventario` AS `isInventory`,`t`.`comisionantes` AS `hasComission` from `vn2008`.`warehouse` `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 `warehouseAlias` --- - -/*!50001 DROP VIEW IF EXISTS `warehouseAlias`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouseAlias` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `worker` --- - -/*!50001 DROP VIEW IF EXISTS `worker`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `worker` AS select `t`.`Id_Trabajador` AS `id`,`t`.`CodigoTrabajador` AS `workerCode`,`t`.`Nombre` AS `firstName`,`t`.`Apellidos` AS `name`,`t`.`user_id` AS `userFk`,`t`.`boss` AS `bossFk` from `vn2008`.`Trabajadores` `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 `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeam` AS select `w`.`team` AS `team`,`w`.`user` AS `user`,`w`.`id` AS `id`,`t`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`workerTeam` `w` left join `vn2008`.`Trabajadores` `t` on((`t`.`user_id` = `w`.`user`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Current Database: `salix` --- - -USE `salix`; - --- --- Final view structure for view `Account` --- - -/*!50001 DROP VIEW IF EXISTS `Account`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Account` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`password` AS `password`,`u`.`role` AS `roleFk`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`created` AS `created`,`u`.`updated` AS `updated` 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 `Accounting` --- - -/*!50001 DROP VIEW IF EXISTS `Accounting`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Accounting` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `Address` --- - -/*!50001 DROP VIEW IF EXISTS `Address`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Address` AS select `a`.`id_consigna` AS `id`,`a`.`consignatario` AS `consignee`,`a`.`domicilio` AS `street`,`a`.`poblacion` AS `city`,`a`.`codPostal` AS `postcode`,`a`.`province_id` AS `provinceFk`,`a`.`telefono` AS `phone`,`a`.`movil` AS `mobile`,`a`.`active` AS `isEnabled`,`a`.`predeterminada` AS `isDefaultAddress`,`a`.`Id_cliente` AS `clientFk`,`a`.`Id_Agencia` AS `defaultAgencyFk`,`a`.`longitude` AS `longitude`,`a`.`latitude` AS `latitude`,`a`.`isEqualizated` AS `isEqualizated` from `vn2008`.`Consignatarios` `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 `Agency` --- - -/*!50001 DROP VIEW IF EXISTS `Agency`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Agency` AS select `a`.`agency_id` AS `id`,`a`.`name` AS `name`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`por_volumen` AS `isVolumetric`,`a`.`Id_Banco` AS `bankFk`,`a`.`warehouse_alias_id` AS `warehouseAliasFk` from `vn2008`.`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 `AgencyMode` --- - -/*!50001 DROP VIEW IF EXISTS `AgencyMode`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `AgencyMode` AS select `a`.`Id_Agencia` AS `id`,`a`.`Agencia` AS `name`,`a`.`description` AS `description`,`a`.`Vista` AS `agencyTypeFk`,`a`.`m3` AS `m3`,`a`.`agency_id` AS `agencyFk`,`a`.`inflacion` AS `inflation`,`a`.`send_mail` AS `sendMailTo`,`a`.`tpv` AS `isForTicket` from `vn2008`.`Agencias` `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 `Bank` --- - -/*!50001 DROP VIEW IF EXISTS `Bank`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Bank` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `cash`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `City` --- - -/*!50001 DROP VIEW IF EXISTS `City`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `City` AS select `c`.`city_id` AS `id`,`c`.`name` AS `name`,`c`.`province_id` AS `provinceFk` from `vn2008`.`city` `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 `Client` --- - -/*!50001 DROP VIEW IF EXISTS `Client`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`province_id` AS `provinceFk`,`c`.`Id_Pais` AS `countryFk`,`c`.`e-mail` AS `email`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`activo` AS `active`,`c`.`descuento` AS `discount`,`c`.`credito` AS `credit`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`cc` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`RE` AS `equalizationTax`,`c`.`invoice` AS `hasToInvoice`,`c`.`mail` AS `invoiceByEmail`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `sepaVnl`,`c`.`coreVnl` AS `coreVnl`,`c`.`coreVnh` AS `coreVnh`,`c`.`EYPBC` AS `eypbc`,`c`.`calidad` AS `quality`,`c`.`vies` AS `vies`,`c`.`real` AS `isRelevant`,`c`.`clientes_tipo_id` AS `typeFk`,`c`.`Cuenta` AS `accountingAccount`,`c`.`created` AS `created` from `vn2008`.`Clientes` `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 `ClientCredit` --- - -/*!50001 DROP VIEW IF EXISTS `ClientCredit`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ClientCredit` AS select `c`.`id` AS `id`,`c`.`Id_Cliente` AS `clientFk`,`c`.`Id_Trabajador` AS `employeeFk`,`c`.`amount` AS `amount`,`c`.`odbc_date` AS `created` from `vn2008`.`credit` `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 `ClientCreditLimit` --- - -/*!50001 DROP VIEW IF EXISTS `ClientCreditLimit`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ClientCreditLimit` AS select `l`.`id` AS `id`,`l`.`maxAmount` AS `maxAmount`,`l`.`roleFk` AS `roleFk` from `vn`.`clientCreditLimit` `l` */; -/*!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 `ClientObservation` --- - -/*!50001 DROP VIEW IF EXISTS `ClientObservation`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ClientObservation` AS select `o`.`client_observation_id` AS `id`,`o`.`Id_Cliente` AS `clientFk`,`o`.`Id_Trabajador` AS `employeeFk`,`o`.`text` AS `text`,`o`.`odbc_date` AS `created` from `vn2008`.`client_observation` `o` */; -/*!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 `ClientType` --- - -/*!50001 DROP VIEW IF EXISTS `ClientType`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ClientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type` from `vn2008`.`clientes_tipo` `ct` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ContactChannel` --- - -/*!50001 DROP VIEW IF EXISTS `ContactChannel`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ContactChannel` AS select `c`.`chanel_id` AS `id`,`c`.`name` AS `name` from `vn2008`.`chanel` `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 `Country` --- - -/*!50001 DROP VIEW IF EXISTS `Country`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Country` AS select `c`.`Id` AS `id`,`c`.`Pais` AS `name`,`c`.`CEE` AS `inCee`,`c`.`Codigo` AS `code`,`c`.`Id_Moneda` AS `currencyFk`,`c`.`Id_Paisreal` AS `realCountryFk` from `vn2008`.`Paises` `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 `CreditClassification` --- - -/*!50001 DROP VIEW IF EXISTS `CreditClassification`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `CreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `clientFk`,`vn`.`creditClassification`.`dateStart` AS `started`,`vn`.`creditClassification`.`dateEnd` AS `ended` from `vn`.`creditClassification` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Employee` --- - -/*!50001 DROP VIEW IF EXISTS `Employee`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Employee` AS select `e`.`Id_Trabajador` AS `id`,`e`.`Nombre` AS `name`,`e`.`Apellidos` AS `surname`,`e`.`user_id` AS `userFk` from `vn2008`.`Trabajadores` `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 `PayMethod` --- - -/*!50001 DROP VIEW IF EXISTS `PayMethod`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `PayMethod` AS select `m`.`id` AS `id`,`m`.`name` AS `name`,`m`.`graceDays` AS `graceDays`,`m`.`deudaviva` AS `outstandingDebt`,`m`.`ibanRequired` AS `ibanRequired` from `vn2008`.`pay_met` `m` */; -/*!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 `Province` --- - -/*!50001 DROP VIEW IF EXISTS `Province`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Province` AS select `p`.`province_id` AS `id`,`p`.`name` AS `name`,`p`.`Paises_Id` AS `countryFk`,`p`.`warehouse_id` AS `warehouseFk`,`p`.`zone` AS `zoneFk` from `vn2008`.`province` `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` --- - -/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Role` AS select `r`.`id` AS `id`,`r`.`name` AS `name`,`r`.`description` AS `description`,`r`.`created` AS `created`,`r`.`modified` AS `modified` from `account`.`role` `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 `RoleMapping` --- - -/*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `RoleMapping` AS select ((`u`.`id` * 1000) + `r`.`inheritsFrom`) AS `id`,'USER' AS `principalType`,`u`.`id` AS `principalId`,`r`.`inheritsFrom` AS `roleId` from (`account`.`user` `u` join `account`.`roleRole` `r` on((`r`.`role` = `u`.`role`))) */; -/*!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 `Route` --- - -/*!50001 DROP VIEW IF EXISTS `Route`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Route` AS select `r`.`Id_Ruta` AS `id`,`r`.`Fecha` AS `date` from `vn2008`.`Rutas` `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 `State` --- - -/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `State` AS select `s`.`id` AS `id`,`s`.`name` AS `name`,`s`.`order` AS `order`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code` from `vn2008`.`state` `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 `Ticket` --- - -/*!50001 DROP VIEW IF EXISTS `Ticket`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Ticket` AS select `t`.`Id_Ticket` AS `id`,`t`.`Id_Agencia` AS `agencyFk`,`t`.`Id_Trabajador` AS `employeeFk`,`t`.`Fecha` AS `date`,`t`.`Hora` AS `hour`,`t`.`Id_Cliente` AS `clientFk`,`t`.`Id_Consigna` AS `addressFk` from `vn2008`.`Tickets` `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 `TicketState` --- - -/*!50001 DROP VIEW IF EXISTS `TicketState`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `TicketState` AS select `i`.`inter_id` AS `id`,`i`.`Id_Ticket` AS `ticketFk`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `employeeFk`,`i`.`odbc_date` AS `updated` from `vncontrol`.`inter` `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 `Vehicle` --- - -/*!50001 DROP VIEW IF EXISTS `Vehicle`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Vehicle` AS select `v`.`Id_Vehiculo` AS `id`,`v`.`Matricula` AS `numberPlate`,`v`.`Marca` AS `tradeMark`,`v`.`Modelo` AS `model`,`v`.`empresa_id` AS `companyFk`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`active` AS `isActive` from `vn2008`.`Vehiculos` `v` */; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Warehouse` AS select `w`.`id` AS `id`,`w`.`name` AS `name`,`w`.`tpv` AS `tpv`,`w`.`inventario` AS `inventory`,`w`.`isManaged` AS `isManaged` from `vn2008`.`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 `WarehouseAlias` --- - -/*!50001 DROP VIEW IF EXISTS `WarehouseAlias`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `WarehouseAlias` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Worker` --- - -/*!50001 DROP VIEW IF EXISTS `Worker`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Worker` AS select `e`.`Id_Trabajador` AS `id`,`e`.`Nombre` AS `name`,`e`.`Apellidos` AS `surname`,`e`.`user_id` AS `userFk` from `vn2008`.`Trabajadores` `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 `Zone` --- - -/*!50001 DROP VIEW IF EXISTS `Zone`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `Zone` AS select `z`.`zone_id` AS `id`,`z`.`name` AS `name`,`z`.`printingOrder` AS `printingOrder` from `vn2008`.`zones` `z` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Current Database: `bs` --- - -USE `bs`; - --- --- Final view structure for view `VentasPorCliente` --- - -/*!50001 DROP VIEW IF EXISTS `VentasPorCliente`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `VentasPorCliente` AS select `v`.`Id_Cliente` AS `Id_Cliente`,round(sum(`v`.`importe`),0) AS `VentaBasica`,`t`.`year` AS `year`,`t`.`month` AS `month` from (`vn2008`.`time` `t` join `bs`.`ventas` `v` on((`v`.`fecha` = `t`.`date`))) group by `v`.`Id_Cliente`,`t`.`year`,`t`.`month` */; -/*!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_ventas` --- - -/*!50001 DROP VIEW IF EXISTS `v_ventas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ventas` AS select (`bs`.`ventas`.`importe` * `vn2008`.`Movimientos`.`Cantidad`) AS `importe`,`bs`.`ventas`.`recargo` AS `recargo`,`vn2008`.`time`.`year` AS `year`,`vn2008`.`time`.`month` AS `month`,`vn2008`.`time`.`week` AS `week`,`vn2008`.`time`.`day` AS `day` from ((`bs`.`ventas` join `vn2008`.`time` on((`vn2008`.`time`.`date` = `bs`.`ventas`.`fecha`))) join `vn2008`.`Movimientos` on((`bs`.`ventas`.`Id_Movimiento` = `vn2008`.`Movimientos`.`Id_Movimiento`))) group by `vn2008`.`time`.`date` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Current Database: `account` -- @@ -68393,6 +69112,7 @@ USE `account`; -- Final view structure for view `accountDovecot` -- +/*!50001 DROP TABLE IF EXISTS `accountDovecot`*/; /*!50001 DROP VIEW IF EXISTS `accountDovecot`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68407,28 +69127,11 @@ USE `account`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `accountNss` --- - -/*!50001 DROP VIEW IF EXISTS `accountNss`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `accountNss` AS select `u`.`name` AS `surname`,`u`.`name` AS `name`,`u`.`password` AS `password`,concat(`c`.`homedir`,'/',`u`.`name`) AS `home`,`c`.`shell` AS `shell`,`c`.`min` AS `min`,`c`.`max` AS `max`,`c`.`warn` AS `warn`,`c`.`inact` AS `inact` from ((`user` `u` join `account` `a` on((`u`.`id` = `a`.`id`))) join `accountConfig` `c`) where (`u`.`active` <> 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 `accountPam` -- +/*!50001 DROP TABLE IF EXISTS `accountPam`*/; /*!50001 DROP VIEW IF EXISTS `accountPam`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68447,6 +69150,7 @@ USE `account`; -- Final view structure for view `userRole` -- +/*!50001 DROP TABLE IF EXISTS `userRole`*/; /*!50001 DROP VIEW IF EXISTS `userRole`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68465,6 +69169,7 @@ USE `account`; -- Final view structure for view `userView` -- +/*!50001 DROP TABLE IF EXISTS `userView`*/; /*!50001 DROP VIEW IF EXISTS `userView`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68474,17 +69179,4151 @@ USE `account`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `userView` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`role` AS `role`,`u`.`recoverPass` AS `recoverPass` from `user` `u` where (`u`.`name` = `account`.`userGetName`()) */ +/*!50001 VIEW `userView` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`nickname` AS `nickname`,`u`.`lang` AS `lang`,`u`.`role` AS `role`,`u`.`recoverPass` AS `recoverPass` from `user` `u` where (`u`.`name` = `account`.`userGetName`()) */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Current Database: `cache` +-- Current Database: `util` -- -USE `cache`; +USE `util`; + +-- +-- Current Database: `vn2008` +-- + +USE `vn2008`; + +-- +-- Final view structure for view `V_edi_item_track` +-- + +/*!50001 DROP TABLE IF EXISTS `V_edi_item_track`*/; +/*!50001 DROP VIEW IF EXISTS `V_edi_item_track`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `V_edi_item_track` AS select `edi`.`item_track`.`item_id` AS `item_id`,`edi`.`item_track`.`s1` AS `s1`,`edi`.`item_track`.`s2` AS `s2`,`edi`.`item_track`.`s3` AS `s3`,`edi`.`item_track`.`s4` AS `s4`,`edi`.`item_track`.`s5` AS `s5`,`edi`.`item_track`.`s6` AS `s6`,`edi`.`item_track`.`kop` AS `kop`,`edi`.`item_track`.`pac` AS `pac`,`edi`.`item_track`.`cat` AS `cat`,`edi`.`item_track`.`ori` AS `ori`,`edi`.`item_track`.`pro` AS `pro`,`edi`.`item_track`.`sub` AS `sub`,`edi`.`item_track`.`package` AS `package` from `edi`.`item_track` */; +/*!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 `VerEspionaje` +-- + +/*!50001 DROP TABLE IF EXISTS `VerEspionaje`*/; +/*!50001 DROP VIEW IF EXISTS `VerEspionaje`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `VerEspionaje` AS select `Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`Espionajes`.`Fecha` AS `Fecha`,`Espionajes`.`HoraEntrada` AS `HoraEntrada`,`Espionajes`.`HoraSalida` AS `HoraSalida`,`Espionajes`.`Id_Equipo` AS `Id_Equipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador` from (`Espionajes` join `Trabajadores` on((`Espionajes`.`Id_Trabajador` = `Trabajadores`.`Id_Trabajador`))) order by `Trabajadores`.`CodigoTrabajador`,`Espionajes`.`Fecha` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `account_customer` +-- + +/*!50001 DROP TABLE IF EXISTS `account_customer`*/; +/*!50001 DROP VIEW IF EXISTS `account_customer`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `account_customer` AS select `e`.`description` AS `description`,`vn2008`.`cc_to_iban`(concat(`a`.`entity_id`,`a`.`office`,`a`.`DC`,`a`.`number`)) AS `iban`,`a`.`entity_id` AS `entity_id`,`a`.`office` AS `office`,`a`.`DC` AS `dc`,`a`.`number` AS `number` from ((`provider_account_customer` `c` join `Proveedores_account` `a` on((`a`.`Id_Proveedores_account` = `c`.`account_id`))) join `entity` `e` on((`a`.`entity_id` = `e`.`entity_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 `awb_volume` +-- + +/*!50001 DROP TABLE IF EXISTS `awb_volume`*/; +/*!50001 DROP VIEW IF EXISTS `awb_volume`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_volume` AS select `ar`.`awb_id` AS `awb_id`,(((`c`.`Etiquetas` * `a`.`density`) * if((`cu`.`Volumen` > 0),`cu`.`Volumen`,((`cu`.`X` * `cu`.`Y`) * if((`cu`.`Z` = 0),(`a`.`Medida` + 10),`cu`.`Z`)))) / 167000) AS `volume` from (((((((`Compres` `c` join `Articles` `a` on((`c`.`Id_Article` = `a`.`Id_Article`))) join `Tipos` `t` on((`a`.`tipo_id` = `t`.`tipo_id`))) join `Cubos` `cu` on((`cu`.`Id_Cubo` = `c`.`Id_Cubo`))) join `Entradas` `e` on((`c`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `tr` on((`tr`.`id` = `e`.`travel_id`))) join `recibida_entrada` `re` on((`c`.`Id_Entrada` = `re`.`Id_Entrada`))) join `awb_recibida` `ar` on((`re`.`awb_recibida` = `ar`.`recibida_id`))) where (`tr`.`shipment` > makedate((year(curdate()) - 1),1)) */; +/*!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` +-- + +/*!50001 DROP TABLE IF EXISTS `cdr`*/; +/*!50001 DROP VIEW IF EXISTS `cdr`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `cdr` AS select `c`.`call_date` AS `calldate`,`c`.`clid` AS `clid`,`c`.`src` AS `src`,`c`.`dst` AS `dst`,`c`.`dcontext` AS `dcontext`,`c`.`channel` AS `channel`,`c`.`dst_channel` AS `dstchannel`,`c`.`last_app` AS `lastapp`,`c`.`last_data` AS `lastdata`,`c`.`duration` AS `duration`,`c`.`billsec` AS `billsec`,`c`.`disposition` AS `disposition`,`c`.`ama_flags` AS `amaflags`,`c`.`account_code` AS `accountcode`,`c`.`unique_id` AS `uniqueid`,`c`.`user_field` AS `userfield` from `pbx`.`cdr` `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 `clientMana` +-- + +/*!50001 DROP TABLE IF EXISTS `clientMana`*/; +/*!50001 DROP VIEW IF EXISTS `clientMana`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientMana` AS select `t`.`Id_Cliente` AS `Id_Cliente`,`mc`.`Valor` AS `ManaUnitario`,(`mc`.`Valor` * `m`.`Cantidad`) AS `ManaTotal`,`t`.`Id_Ticket` AS `Id_Ticket`,`m`.`Id_Article` AS `Id_Article`,`m`.`Concepte` AS `Concepte`,`m`.`Cantidad` AS `Cantidad`,`m`.`Preu` AS `Preu`,`t`.`Fecha` AS `Fecha`,`m`.`Id_Movimiento` AS `Id_Movimiento` from ((((`vn2008`.`Tickets` `t` join `vn2008`.`Movimientos` `m` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) join `vn2008`.`Movimientos_componentes` `mc` on((`mc`.`Id_Movimiento` = `m`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on((`tc`.`Id_Componente` = `mc`.`Id_Componente`))) join `vn2008`.`tarifa_componentes_series` `tcs` on((`tc`.`tarifa_componentes_series_id` = `tcs`.`tarifa_componentes_series_id`))) where ((`t`.`Fecha` >= '2016-01-01') and (`tcs`.`Serie` = 'cartera_comercial') and (`mc`.`Valor` <> 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 `edi_article` +-- + +/*!50001 DROP TABLE IF EXISTS `edi_article`*/; +/*!50001 DROP VIEW IF EXISTS `edi_article`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `edi_article` AS select `edi`.`item`.`id` AS `id`,`edi`.`item`.`product_name` AS `product_name`,`edi`.`item`.`name` AS `name`,`edi`.`item`.`plant_id` AS `plant_id`,`edi`.`item`.`group_id` AS `group_id`,`edi`.`item`.`entry_date` AS `entry_date`,`edi`.`item`.`expiry_date` AS `expiry_date`,`edi`.`item`.`change_date_time` AS `change_date_time` from `edi`.`item` */; +/*!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_bucket` +-- + +/*!50001 DROP TABLE IF EXISTS `edi_bucket`*/; +/*!50001 DROP VIEW IF EXISTS `edi_bucket`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `edi_bucket` AS select (cast(`edi`.`bucket`.`bucket_id` as char charset utf8) collate utf8_general_ci) AS `bucket_id`,`edi`.`bucket`.`bucket_type_id` AS `bucket_type_id`,`edi`.`bucket`.`description` AS `description`,`edi`.`bucket`.`x_size` AS `x_size`,`edi`.`bucket`.`y_size` AS `y_size`,`edi`.`bucket`.`z_size` AS `z_size`,`edi`.`bucket`.`entry_date` AS `entry_date`,`edi`.`bucket`.`expiry_date` AS `expiry_date`,`edi`.`bucket`.`change_date_time` AS `change_date_time` from `edi`.`bucket` */; +/*!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_bucket_type` +-- + +/*!50001 DROP TABLE IF EXISTS `edi_bucket_type`*/; +/*!50001 DROP VIEW IF EXISTS `edi_bucket_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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `edi_bucket_type` AS select `edi`.`bucket_type`.`bucket_type_id` AS `bucket_type_id`,`edi`.`bucket_type`.`description` AS `description`,`edi`.`bucket_type`.`entry_date` AS `entry_date`,`edi`.`bucket_type`.`expiry_date` AS `expiry_date`,`edi`.`bucket_type`.`change_date_time` AS `change_date_time` from `edi`.`bucket_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_feature` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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` +-- + +/*!50001 DROP TABLE IF EXISTS `edi_specie`*/; +/*!50001 DROP VIEW IF EXISTS `edi_specie`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `edi_specie` AS select `edi`.`specie`.`specie_id` AS `specie_id`,`edi`.`specie`.`genus_id` AS `genus_id`,`edi`.`specie`.`latin_species_name` AS `latin_species_name`,`edi`.`specie`.`entry_date` AS `entry_date`,`edi`.`specie`.`expiry_date` AS `expiry_date`,`edi`.`specie`.`change_date_time` AS `change_date_time` from `edi`.`specie` */; +/*!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_supplier` +-- + +/*!50001 DROP TABLE IF EXISTS `edi_supplier`*/; +/*!50001 DROP VIEW IF EXISTS `edi_supplier`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `edi_supplier` AS select `edi`.`supplier`.`supplier_id` AS `supplier_id`,`edi`.`supplier`.`company_name` AS `company_name` from `edi`.`supplier` */; +/*!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_type` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 `itemTag` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 `itemTagArranged` +-- + +/*!50001 DROP TABLE IF EXISTS `itemTagArranged`*/; +/*!50001 DROP VIEW IF EXISTS `itemTagArranged`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemTagArranged` AS select `i`.`itemFk` AS `itemFk`,`i`.`tag1` AS `tag1`,`i`.`val1` AS `val1`,`i`.`tag2` AS `tag2`,`i`.`val2` AS `val2`,`i`.`tag3` AS `tag3`,`i`.`val3` AS `val3`,`i`.`tag4` AS `tag4`,`i`.`val4` AS `val4`,`i`.`tag5` AS `tag5`,`i`.`val5` AS `val5`,`i`.`tag6` AS `tag6`,`i`.`val6` AS `val6`,`i`.`description` AS `description` from `vn`.`itemTagArranged` `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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `item_entry_in` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`landing` AS `dat`,`m`.`Id_Article` AS `item_id`,`m`.`Cantidad` AS `amount`,`t`.`received` AS `received` from ((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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` or ifnull(`co`.`valor`,0)) AS `delivered` from (((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `t` on((`e`.`travel_id` = `t`.`id`))) left join `Compres_ok` `co` on(((`co`.`Id_Compra` = `m`.`Id_Compra`) and (`co`.`Id_Accion` = 3)))) 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_entry_outkk` +-- + +/*!50001 DROP TABLE IF EXISTS `item_entry_outkk`*/; +/*!50001 DROP VIEW IF EXISTS `item_entry_outkk`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `item_entry_outkk` 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` AS `delivered` from ((`Compres` `m` join `Entradas` `e` on((`m`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `t` on((`e`.`travel_id` = `t`.`id`))) 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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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`,(`ts`.`alertLevel` = 3) AS `ready`,`t`.`Factura` AS `invoice`,ifnull(`ts`.`alertLevel`,0) AS `alertLevel` from ((`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) left join `vn`.`ticketState` `ts` on((`t`.`Id_Ticket` = `ts`.`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 `new_viewkk` +-- + +/*!50001 DROP TABLE IF EXISTS `new_viewkk`*/; +/*!50001 DROP VIEW IF EXISTS `new_viewkk`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `new_viewkk` AS select `vn`.`workerDocument`.`id` AS `id`,`vn`.`workerDocument`.`worker` AS `worker`,`vn`.`workerDocument`.`document` AS `document` 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 `order` +-- + +/*!50001 DROP TABLE IF EXISTS `order`*/; +/*!50001 DROP VIEW IF EXISTS `order`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `order` AS select `hedera`.`order`.`id` AS `id`,`hedera`.`order`.`date_make` AS `date_make`,`hedera`.`order`.`date_send` AS `date_send`,`hedera`.`order`.`customer_id` AS `customer_id`,`hedera`.`order`.`delivery_method_id` AS `delivery_method_id`,`hedera`.`order`.`agency_id` AS `agency_id`,`hedera`.`order`.`address_id` AS `address_id`,`hedera`.`order`.`note` AS `note`,`hedera`.`order`.`confirmed` AS `confirmed`,`hedera`.`order`.`is_bionic` AS `is_bionic`,`hedera`.`order`.`source_app` AS `source_app` from `hedera`.`order` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `order_component` +-- + +/*!50001 DROP TABLE IF EXISTS `order_component`*/; +/*!50001 DROP VIEW IF EXISTS `order_component`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_component` AS select `c`.`order_row_id` AS `order_row_id`,`c`.`component_id` AS `component_id`,`c`.`price` AS `price` from `hedera`.`order_component` `c` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `order_row` +-- + +/*!50001 DROP TABLE IF EXISTS `order_row`*/; +/*!50001 DROP VIEW IF EXISTS `order_row`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_row` AS select `order_row`.`id` AS `id`,`order_row`.`order_id` AS `order_id`,`order_row`.`item_id` AS `item_id`,`order_row`.`warehouse_id` AS `warehouse_id`,`order_row`.`shipment` AS `shipment`,`order_row`.`amount` AS `amount`,`order_row`.`price` AS `price`,`order_row`.`rate` AS `rate`,`order_row`.`created` AS `created`,`order_row`.`Id_Movimiento` AS `Id_Movimiento` from `hedera`.`order_row` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `person_user` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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`.`userGetId`()) */; +/*!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_clientes` +-- + +/*!50001 DROP TABLE IF EXISTS `proveedores_clientes`*/; +/*!50001 DROP VIEW IF EXISTS `proveedores_clientes`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `proveedores_clientes` AS select `Proveedores`.`Id_Proveedor` AS `Id_Proveedor`,`Proveedores`.`Proveedor` AS `Proveedor`,`Clientes`.`id_cliente` AS `Id_Cliente`,`Clientes`.`cliente` AS `Cliente` from (`Proveedores` join `Clientes` on((`Proveedores`.`NIF` = `Clientes`.`if`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `sms` +-- + +/*!50001 DROP TABLE IF EXISTS `sms`*/; +/*!50001 DROP VIEW IF EXISTS `sms`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `sms` AS select `t`.`id` AS `id`,`t`.`senderFk` AS `Id_trabajador`,`t`.`destinationFk` AS `Id_Cliente`,`t`.`sender` AS `from`,`t`.`destination` AS `to`,`t`.`message` AS `text`,`t`.`statusCode` AS `sent`,`t`.`status` AS `response`,`t`.`created` AS `DATE_ODBC` from `vn`.`sms` `t` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `tag` +-- + +/*!50001 DROP TABLE IF EXISTS `tag`*/; +/*!50001 DROP VIEW IF EXISTS `tag`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `tag` AS select `t`.`id` AS `id`,`t`.`name` AS `name`,`t`.`free` AS `free`,`t`.`isQuantitatif` AS `isQuantitatif`,`t`.`sourceTable` AS `sourceTable`,`t`.`unit` AS `unit` from `vn`.`tag` `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 `tarifa_componentes` +-- + +/*!50001 DROP TABLE IF EXISTS `tarifa_componentes`*/; +/*!50001 DROP VIEW IF EXISTS `tarifa_componentes`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `tarifa_componentes` AS select `bi`.`tarifa_componentes`.`Id_Componente` AS `Id_Componente`,`bi`.`tarifa_componentes`.`Componente` AS `Componente`,`bi`.`tarifa_componentes`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`,`bi`.`tarifa_componentes`.`tarifa_class` AS `tarifa_class`,`bi`.`tarifa_componentes`.`tax` AS `tax`,`bi`.`tarifa_componentes`.`is_renewable` AS `is_renewable` from `bi`.`tarifa_componentes` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `tarifa_componentes_series` +-- + +/*!50001 DROP TABLE IF EXISTS `tarifa_componentes_series`*/; +/*!50001 DROP VIEW IF EXISTS `tarifa_componentes_series`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `tarifa_componentes_series` AS select `bi`.`tarifa_componentes_series`.`tarifa_componentes_series_id` AS `tarifa_componentes_series_id`,`bi`.`tarifa_componentes_series`.`Serie` AS `Serie`,`bi`.`tarifa_componentes_series`.`base` AS `base` from `bi`.`tarifa_componentes_series` */; +/*!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 `ticketCreationData` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketCreationData`*/; +/*!50001 DROP VIEW IF EXISTS `ticketCreationData`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketCreationData` AS select dayname(`h`.`confirm_date`) AS `DiadelaSemana`,hour(`h`.`confirm_date`) AS `Hora`,cast(`h`.`confirm_date` as date) AS `Fecha`,`h`.`source_app` AS `Dispositivo` from `hedera`.`order` `h` where `h`.`confirm_date` */; +/*!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_Agenda` +-- + +/*!50001 DROP TABLE IF EXISTS `v_Agenda`*/; +/*!50001 DROP VIEW IF EXISTS `v_Agenda`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_Agenda` AS select 'P' AS `Tipo`,`Proveedores`.`Id_Proveedor` AS `Id`,`Proveedores`.`Proveedor` AS `Nombre`,`Proveedores`.`Telefono` AS `Telephone` from `Proveedores` where (`Proveedores`.`Telefono` is not null) union select 'C' AS `Tipo`,`Clientes`.`id_cliente` AS `Id`,`Clientes`.`cliente` AS `Cliente`,`Clientes`.`telefono` AS `Telefono` from `Clientes` where (`Clientes`.`telefono` is not null) union select 'C' AS `Tipo`,`Clientes`.`id_cliente` AS `Id`,`Clientes`.`cliente` AS `Cliente`,`Clientes`.`movil` AS `Movil` from `Clientes` where (`Clientes`.`movil` is not null) union select if(isnull(`Relaciones`.`Id_Proveedor`),'C','P') AS `Tipo`,if(isnull(`Relaciones`.`Id_Proveedor`),`Relaciones`.`Id_Cliente`,`Relaciones`.`Id_Proveedor`) AS `Id`,`Contactos`.`Nombre` AS `Nombre`,`Contactos`.`Telefono` AS `Telefono` from (`Contactos` join `Relaciones` on((`Contactos`.`Id_Contacto` = `Relaciones`.`Id_Contacto`))) where (`Contactos`.`Telefono` is not null) union select if(isnull(`Relaciones`.`Id_Proveedor`),'C','P') AS `Tipo`,if(isnull(`Relaciones`.`Id_Proveedor`),`Relaciones`.`Id_Cliente`,`Relaciones`.`Id_Proveedor`) AS `Id`,`Contactos`.`Nombre` AS `Nombre`,`Contactos`.`Movil` AS `Movil` from (`Contactos` join `Relaciones` on((`Contactos`.`Id_Contacto` = `Relaciones`.`Id_Contacto`))) where (`Contactos`.`Movil` is not null) union select 'T' AS `Tipo`,`Trabajadores`.`Id_Trabajador` AS `Id_Trabajador`,`Trabajadores`.`CodigoTrabajador` AS `CodigoTrabajador`,`Trabajadores`.`extension` AS `extension` from `Trabajadores` where (`Trabajadores`.`extension` is not null) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_Agenda2` +-- + +/*!50001 DROP TABLE IF EXISTS `v_Agenda2`*/; +/*!50001 DROP VIEW IF EXISTS `v_Agenda2`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_Agenda2` AS select `v_Agenda`.`Tipo` AS `Tipo`,`v_Agenda`.`Id` AS `Id`,`v_Agenda`.`Nombre` AS `Nombre`,replace(`v_Agenda`.`Telephone`,' ','') AS `Telefono` from `v_Agenda` where `v_Agenda`.`Telephone` group by replace(`v_Agenda`.`Telephone`,' ','') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_Articles_botanical` +-- + +/*!50001 DROP TABLE IF EXISTS `v_Articles_botanical`*/; +/*!50001 DROP VIEW IF EXISTS `v_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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_Articles_botanical` AS select `ab`.`Id_Article` AS `Id_Article`,ifnull(`ab`.`botanical`,concat(`g`.`latin_genus_name`,' ',ifnull(`s`.`latin_species_name`,''))) AS `edi_botanic` from ((`vn2008`.`Articles_botanical` `ab` left join `edi`.`genus` `g` on((`ab`.`genus_id` = `g`.`genus_id`))) left join `edi`.`specie` `s` on((`s`.`specie_id` = `ab`.`specie_id`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_Movimientos_Volumen_shipping_charge` +-- + +/*!50001 DROP TABLE IF EXISTS `v_Movimientos_Volumen_shipping_charge`*/; +/*!50001 DROP VIEW IF EXISTS `v_Movimientos_Volumen_shipping_charge`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_Movimientos_Volumen_shipping_charge` AS select `M`.`Id_Ticket` AS `Id_Ticket`,`M`.`Id_Movimiento` AS `Id_Movimiento`,`t`.`Fecha` AS `Fecha`,`az`.`price` AS `price`,(((`M`.`Cantidad` * `r`.`cm3`) / `cb`.`Volumen`) * `az`.`price`) AS `freight` from (((((((`vn2008`.`Movimientos` `M` join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `M`.`Id_Ticket`))) join `vn2008`.`Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `bi`.`rotacion` `r` on(((`r`.`Id_Article` = `M`.`Id_Article`) and (`r`.`warehouse_id` = `t`.`warehouse_id`)))) join `vn2008`.`Cubos` `cb` on((`cb`.`Id_Cubo` = 94))) join `vn2008`.`Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `vn2008`.`Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `vn2008`.`Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = 71)))) */; +/*!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_Ordenes` +-- + +/*!50001 DROP TABLE IF EXISTS `v_Ordenes`*/; +/*!50001 DROP VIEW IF EXISTS `v_Ordenes`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_Ordenes` AS select `Ordenes`.`Id_ORDEN` AS `Id_ORDEN`,`Ordenes`.`ORDEN` AS `ORDEN`,`Ordenes`.`datORDEN` AS `datORDEN`,`Ordenes`.`datTICKET` AS `datTICKET`,`Ordenes`.`CodVENDEDOR` AS `CodVENDEDOR`,`Ordenes`.`CodCOMPRADOR` AS `CodCOMPRADOR`,`Ordenes`.`CANTIDAD` AS `CANTIDAD`,`Ordenes`.`PRECIOMAX` AS `PRECIOMAX`,`Ordenes`.`PREU` AS `PREU`,`Ordenes`.`Id_ARTICLE` AS `Id_ARTICLE`,`Ordenes`.`Id_CLIENTE` AS `Id_CLIENTE`,`Ordenes`.`COMENTARIO` AS `COMENTARIO`,`Ordenes`.`OK` AS `OK`,`Ordenes`.`TOTAL` AS `TOTAL`,`Ordenes`.`datCOMPRA` AS `datCOMPRA`,`Ordenes`.`KO` AS `KO`,`Ordenes`.`Id_Movimiento` AS `Id_Movimiento`,`Ordenes`.`odbc_date` AS `odbc_date` from `Ordenes` */; +/*!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_XDiario_ALL` +-- + +/*!50001 DROP TABLE IF EXISTS `v_XDiario_ALL`*/; +/*!50001 DROP VIEW IF EXISTS `v_XDiario_ALL`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_XDiario_ALL` AS select `bi`.`XDiario_ALL`.`empresa_id` AS `empresa_id`,`bi`.`XDiario_ALL`.`SUBCTA` AS `SUBCTA`,`bi`.`XDiario_ALL`.`Eurodebe` AS `Eurodebe`,`bi`.`XDiario_ALL`.`Eurohaber` AS `Eurohaber`,`bi`.`XDiario_ALL`.`Fecha` AS `Fecha`,`bi`.`XDiario_ALL`.`FECHA_EX` AS `FECHA_EX` from `bi`.`XDiario_ALL` */; +/*!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_accion` +-- + +/*!50001 DROP TABLE IF EXISTS `v_accion`*/; +/*!50001 DROP VIEW IF EXISTS `v_accion`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_accion` AS select `vncontrol`.`accion`.`accion_id` AS `accion_id`,`vncontrol`.`accion`.`accion` AS `accion` from `vncontrol`.`accion` */; +/*!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_account` +-- + +/*!50001 DROP TABLE IF EXISTS `v_account`*/; +/*!50001 DROP VIEW IF EXISTS `v_account`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_account` AS select `a`.`id` AS `user_id` from `account`.`account` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_analisis_ventas` +-- + +/*!50001 DROP TABLE IF EXISTS `v_analisis_ventas`*/; +/*!50001 DROP VIEW IF EXISTS `v_analisis_ventas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_analisis_ventas` AS select `bi`.`analisis_ventas`.`Familia` AS `Familia`,`bi`.`analisis_ventas`.`Reino` AS `Reino`,`bi`.`analisis_ventas`.`Comercial` AS `Comercial`,`bi`.`analisis_ventas`.`Comprador` AS `Comprador`,`bi`.`analisis_ventas`.`Provincia` AS `Provincia`,`bi`.`analisis_ventas`.`almacen` AS `almacen`,`bi`.`analisis_ventas`.`Año` AS `Año`,`bi`.`analisis_ventas`.`Mes` AS `Mes`,`bi`.`analisis_ventas`.`Semana` AS `Semana`,`bi`.`analisis_ventas`.`Vista` AS `Vista`,`bi`.`analisis_ventas`.`Importe` AS `Importe` from `bi`.`analisis_ventas` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_awb_volumen` +-- + +/*!50001 DROP TABLE IF EXISTS `v_awb_volumen`*/; +/*!50001 DROP VIEW IF EXISTS `v_awb_volumen`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_awb_volumen` AS select `a`.`id` AS `awb_id`,`a`.`codigo` AS `codigo`,`a`.`importe` AS `importe`,cast(sum(`v`.`volume`) as signed) AS `Vol_Total` from (`awb` `a` join `awb_volume` `v` on((`v`.`awb_id` = `a`.`id`))) group by `a`.`id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_barcodes` +-- + +/*!50001 DROP TABLE IF EXISTS `v_barcodes`*/; +/*!50001 DROP VIEW IF EXISTS `v_barcodes`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_barcodes` AS select `Articles`.`Id_Article` AS `code`,`Articles`.`Id_Article` AS `Id_Article` from `Articles` union all select `barcodes`.`code` AS `code`,`barcodes`.`Id_Article` AS `Id_Article` from `barcodes` union all select `c`.`Id_Compra` AS `Id_Compra`,`c`.`Id_Article` AS `Id_Article` from ((`Compres` `c` join `Entradas` `e` on((`c`.`Id_Entrada` = `e`.`Id_Entrada`))) join `travel` `tr` on((`tr`.`id` = `e`.`travel_id`))) where (`tr`.`landing` >= (curdate() + interval -(15) day)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_barcodes_plus` +-- + +/*!50001 DROP TABLE IF EXISTS `v_barcodes_plus`*/; +/*!50001 DROP VIEW IF EXISTS `v_barcodes_plus`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_barcodes_plus` AS select `cache`.`barcodes`.`code` AS `code`,`cache`.`barcodes`.`Id_Article` AS `Id_Article`,`cache`.`barcodes`.`Article` AS `Article`,`cache`.`barcodes`.`Medida` AS `Medida`,`cache`.`barcodes`.`Color` AS `Color`,`cache`.`barcodes`.`Categoria` AS `Categoria`,`cache`.`barcodes`.`Producer` AS `Producer` from `cache`.`barcodes` */; +/*!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_botanic_export` +-- + +/*!50001 DROP TABLE IF EXISTS `v_botanic_export`*/; +/*!50001 DROP VIEW IF EXISTS `v_botanic_export`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_botanic_export` AS select concat(ifnull(concat(`eg`.`latin_genus_name`,' '),''),ifnull(`es`.`latin_species_name`,'')) AS `Nom_botanic`,`be`.`Id_Paises` AS `Id_Paises`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description` from ((`vn2008`.`botanic_export` `be` left join `vn2008`.`edi_genus` `eg` on((`be`.`edi_genus_id` = `eg`.`genus_id`))) left join `vn2008`.`edi_specie` `es` on((`be`.`edi_specie_id` = `es`.`specie_id`))) order by concat(`eg`.`latin_genus_name`,' ',`es`.`latin_species_name`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_compres` +-- + +/*!50001 DROP TABLE IF EXISTS `v_compres`*/; +/*!50001 DROP VIEW IF EXISTS `v_compres`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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`,`an`.`nicho` AS `Nicho`,`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`,`A`.`iva_group_id` AS `iva_group_id`,(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 (((((((((`Compres` `C` join `Entradas` `E` on((`C`.`Id_Entrada` = `E`.`Id_Entrada`))) join `travel` `TR` on((`TR`.`id` = `E`.`travel_id`))) join `warehouse` `W_IN` on((`W_IN`.`id` = `TR`.`warehouse_id`))) join `warehouse` `W_OUT` on((`W_OUT`.`id` = `TR`.`warehouse_id_out`))) join `Articles` `A` on((`C`.`Id_Article` = `A`.`Id_Article`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) join `reinos` `RN` on((`RN`.`id` = `TP`.`reino_id`))) join `Cubos` `cb` on((`cb`.`Id_Cubo` = `C`.`Id_Cubo`))) left join `Articles_nicho` `an` on(((`A`.`Id_Article` = `an`.`Id_Article`) and (`an`.`warehouse_id` = `W_IN`.`id`)))) where ((not(`W_IN`.`fuente`)) and (not(`E`.`Inventario`)) and (not(`E`.`Redada`))) */; +/*!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_departure_limit` +-- + +/*!50001 DROP TABLE IF EXISTS `v_departure_limit`*/; +/*!50001 DROP VIEW IF EXISTS `v_departure_limit`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_departure_limit` AS select `cache`.`departure_limit`.`warehouse_id` AS `warehouse_id`,`cache`.`departure_limit`.`fecha` AS `fecha`,`cache`.`departure_limit`.`hora` AS `hora`,`cache`.`departure_limit`.`minSpeed` AS `minSpeed` from `cache`.`departure_limit` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_descuadre_bionic` +-- + +/*!50001 DROP TABLE IF EXISTS `v_descuadre_bionic`*/; +/*!50001 DROP VIEW IF EXISTS `v_descuadre_bionic`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_descuadre_bionic` AS select `t`.`Id_Ticket` AS `Id_Ticket`,`t`.`Alias` AS `Alias`,`m`.`Concepte` AS `Concepte`,sum(`mc`.`Valor`) AS `suma_componente`,`m`.`Preu` AS `Preu`,`m`.`Descuento` AS `Descuento`,(((`m`.`Preu` * (100 - `m`.`Descuento`)) / 100) - sum(`mc`.`Valor`)) AS `diferencia`,`t`.`Fecha` AS `Fecha`,((`m`.`Preu` > 0) and (`tp`.`reino_id` <> 6) and (`a`.`tipo_id` not in (7,115)) and (`t`.`warehouse_id` <> 41)) AS `benvenut` from ((((((`Movimientos` `m` join `Tickets` `t` on((`m`.`Id_Ticket` = `t`.`Id_Ticket`))) join `Clientes` `c` on((`t`.`Id_Cliente` = `c`.`id_cliente`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouse_id`))) join `Articles` `a` on((`m`.`Id_Article` = `a`.`Id_Article`))) join `Tipos` `tp` on((`a`.`tipo_id` = `tp`.`tipo_id`))) left join `Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567)) and `w`.`reserve` and `c`.`real` and (`tp`.`reino_id` <> 6)) group by `m`.`Id_Movimiento` having ((abs(`diferencia`) > 0.01) or isnull(`diferencia`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_descuadre_porte` +-- + +/*!50001 DROP TABLE IF EXISTS `v_descuadre_porte`*/; +/*!50001 DROP VIEW IF EXISTS `v_descuadre_porte`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_descuadre_porte` AS select `t`.`Id_Ticket` AS `Id_Ticket`,round(sum((`mc`.`Valor` * `m`.`Cantidad`)),2) AS `suma_componente`,round(`es`.`shipping_charge`,2) AS `teorico_agencia`,round((sum((`mc`.`Valor` * `m`.`Cantidad`)) - `es`.`shipping_charge`),2) AS `diferencia`,`t`.`Fecha` AS `Fecha` from ((((`vn2008`.`Movimientos` `m` left join `vn2008`.`Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on(((`tc`.`Id_Componente` = `mc`.`Id_Componente`) and (`tc`.`tarifa_componentes_series_id` = 6)))) join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) left join `vn2008`.`v_expeditions_shipping_charge` `es` on((`es`.`Id_Ticket` = `t`.`Id_Ticket`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` having ((abs(`diferencia`) > 0.01) or isnull(`diferencia`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_descuadre_porte2` +-- + +/*!50001 DROP TABLE IF EXISTS `v_descuadre_porte2`*/; +/*!50001 DROP VIEW IF EXISTS `v_descuadre_porte2`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_descuadre_porte2` AS select `t`.`Id_Ticket` AS `Id_Ticket`,(`mc`.`Valor` * `m`.`Cantidad`) AS `suma_componente`,`t`.`Fecha` AS `Fecha` from (((`vn2008`.`Movimientos` `m` left join `vn2008`.`Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on(((`tc`.`Id_Componente` = `mc`.`Id_Componente`) and (`tc`.`tarifa_componentes_series_id` = 6)))) join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_empresa` +-- + +/*!50001 DROP TABLE IF EXISTS `v_empresa`*/; +/*!50001 DROP VIEW IF EXISTS `v_empresa`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_empresa` AS select `e`.`logo` AS `logo`,`e`.`id` AS `id`,`e`.`registro` AS `registro`,`e`.`gerente_id` AS `gerente_id`,`e`.`alta` AS `alta`,`t`.`Nombre` AS `Nombre`,`t`.`Apellidos` AS `Apellidos`,`p`.`Proveedor` AS `Proveedor`,`p`.`Domicilio` AS `Domicilio`,`p`.`CP` AS `CP`,`p`.`Localidad` AS `Localidad`,`p`.`NIF` AS `NIF`,`p`.`Telefono` AS `Telefono`,`p`.`Alias` AS `Alias`,`e`.`abbreviation` AS `abbreviation` from ((`empresa` `e` join `Trabajadores` `t` on((`t`.`Id_Trabajador` = `e`.`gerente_id`))) join `Proveedores` `p` on((`p`.`Id_Proveedor` = `e`.`id`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_encajado` +-- + +/*!50001 DROP TABLE IF EXISTS `v_encajado`*/; +/*!50001 DROP VIEW IF EXISTS `v_encajado`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_encajado` AS select hour(`e`.`odbc_date`) AS `hora`,minute(`e`.`odbc_date`) AS `minuto`,ifnull(`c`.`Volumen`,94500) AS `cm3`,`t`.`warehouse_id` AS `warehouse_id` from ((`expeditions` `e` left join `Cubos` `c` on((`c`.`item_id` = `e`.`EsBulto`))) join `Tickets` `t` on((`t`.`Id_Ticket` = `e`.`ticket_id`))) where (`e`.`odbc_date` between curdate() and `DAYEND`(curdate())) */; +/*!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_encajado_ultima_hora` +-- + +/*!50001 DROP TABLE IF EXISTS `v_encajado_ultima_hora`*/; +/*!50001 DROP VIEW IF EXISTS `v_encajado_ultima_hora`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_encajado_ultima_hora` AS select sum((ifnull(`c`.`Volumen`,94500) / 1000000)) AS `m3`,`t`.`warehouse_id` AS `warehouse_id` from ((`expeditions` `e` left join `Cubos` `c` on((`c`.`item_id` = `e`.`EsBulto`))) join `Tickets` `t` on((`t`.`Id_Ticket` = `e`.`ticket_id`))) where ((`e`.`odbc_date` > (now() + interval -(1) hour)) and (`t`.`warehouse_id` in (1,44))) group by `t`.`warehouse_id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_expeditions_shipping_charge` +-- + +/*!50001 DROP TABLE IF EXISTS `v_expeditions_shipping_charge`*/; +/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_charge`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_expeditions_shipping_charge` AS select `t`.`Id_Ticket` AS `Id_Ticket`,sum((`az`.`price` * if(((`e`.`EsBulto` = 71) and isnull(`e`.`Id_Article`) and (`a`.`Vista` = 2)),0.75,1))) AS `shipping_charge`,`t`.`Fecha` AS `Fecha` from ((((((`Tickets` `t` join `Clientes` `cli` on((`cli`.`id_cliente` = `t`.`Id_Cliente`))) left join `expeditions` `e` on((`e`.`ticket_id` = `t`.`Id_Ticket`))) join `Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = `e`.`EsBulto`)))) where ((`t`.`Fecha` >= '2015-10-01') and (`cli`.`real` <> 0) and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_expeditions_shipping_charge2` +-- + +/*!50001 DROP TABLE IF EXISTS `v_expeditions_shipping_charge2`*/; +/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_charge2`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_expeditions_shipping_charge2` AS select `t`.`Id_Ticket` AS `Id_Ticket`,(`az`.`price` * if(((`e`.`EsBulto` = 71) and isnull(`e`.`Id_Article`) and (`a`.`Vista` = 2)),0.75,1)) AS `shipping_charge`,`t`.`Fecha` AS `Fecha`,`t`.`warehouse_id` AS `warehouse_id` from (((((`Tickets` `t` left join `expeditions` `e` on((`e`.`ticket_id` = `t`.`Id_Ticket`))) join `Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = `e`.`EsBulto`)))) where ((`t`.`Fecha` >= '2016-01-01') and (`t`.`empresa_id` in (442,567))) */; +/*!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_fallo` +-- + +/*!50001 DROP TABLE IF EXISTS `v_fallo`*/; +/*!50001 DROP VIEW IF EXISTS `v_fallo`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_fallo` AS select `vncontrol`.`fallo`.`queja_id` AS `queja_id`,`vncontrol`.`fallo`.`accion_id` AS `accion_id` from `vncontrol`.`fallo` */; +/*!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_inter` +-- + +/*!50001 DROP TABLE IF EXISTS `v_inter`*/; +/*!50001 DROP VIEW IF EXISTS `v_inter`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_inter` AS select `vncontrol`.`inter`.`inter_id` AS `inter_id`,`vncontrol`.`inter`.`state_id` AS `state_id`,`vncontrol`.`inter`.`nota` AS `nota`,`vncontrol`.`inter`.`odbc_date` AS `odbc_date`,`vncontrol`.`inter`.`Id_Ticket` AS `Id_Ticket`,`vncontrol`.`inter`.`Id_Trabajador` AS `Id_Trabajador`,`vncontrol`.`inter`.`Id_Supervisor` AS `Id_supervisor` from `vncontrol`.`inter` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_jerarquia` +-- + +/*!50001 DROP TABLE IF EXISTS `v_jerarquia`*/; +/*!50001 DROP VIEW IF EXISTS `v_jerarquia`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_jerarquia` AS select `jerarquia`.`worker_id` AS `Id_Trabajador`,`jerarquia`.`boss_id` AS `boss_id` from `jerarquia` union all select distinct `jerarquia`.`boss_id` AS `Id_Trabajador`,`jerarquia`.`boss_id` AS `boss_id` from `jerarquia` */; +/*!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_location` +-- + +/*!50001 DROP TABLE IF EXISTS `v_location`*/; +/*!50001 DROP VIEW IF EXISTS `v_location`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_location` AS select `tl`.`longitude` AS `longitude`,`tl`.`latitude` AS `latitude`,`t`.`Id_Consigna` AS `Id_Consigna` from (`ticket_location` `tl` join `Tickets` `t` on((`t`.`Id_Ticket` = `tl`.`Id_Ticket`))) where (`t`.`Fecha` >= (curdate() + interval -(3) month)) group by `t`.`Id_Consigna` order by `t`.`Id_Ticket` 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 `v_mana_spellers` +-- + +/*!50001 DROP TABLE IF EXISTS `v_mana_spellers`*/; +/*!50001 DROP VIEW IF EXISTS `v_mana_spellers`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_mana_spellers` AS select `bs`.`mana_spellers`.`Id_Trabajador` AS `Id_Trabajador`,`bs`.`mana_spellers`.`size` AS `size`,`bs`.`mana_spellers`.`used` AS `used` from `bs`.`mana_spellers` */; +/*!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_miriam` +-- + +/*!50001 DROP TABLE IF EXISTS `v_miriam`*/; +/*!50001 DROP VIEW IF EXISTS `v_miriam`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_miriam` AS select `M`.`Id_Article` AS `Id_Article`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,`T`.`Fecha` AS `Fecha`,`T`.`Id_Cliente` AS `Id_Cliente`,(((`M`.`Cantidad` * `M`.`Preu`) * (100 - `M`.`Descuento`)) / 100) AS `Importe` from (((`Tickets` `T` join `Movimientos` `M` on((`T`.`Id_Ticket` = `M`.`Id_Ticket`))) join `Articles` `A` on((`M`.`Id_Article` = `A`.`Id_Article`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) where ((`T`.`Fecha` >= '2011-01-01') and (`A`.`tipo_id` = 7)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_movimientos_log` +-- + +/*!50001 DROP TABLE IF EXISTS `v_movimientos_log`*/; +/*!50001 DROP VIEW IF EXISTS `v_movimientos_log`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_movimientos_log` AS select `bi`.`movimientos_log`.`idmovimientos_log` AS `idmovimientos_log`,`bi`.`movimientos_log`.`Id_Movimiento` AS `Id_Movimiento`,`bi`.`movimientos_log`.`odbc_date` AS `odbc_date`,`bi`.`movimientos_log`.`Id_Trabajador` AS `Id_Trabajador`,`bi`.`movimientos_log`.`field_name` AS `field_name`,`bi`.`movimientos_log`.`new_value` AS `new_value` from `bi`.`movimientos_log` */; +/*!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_movimientos_mark` +-- + +/*!50001 DROP TABLE IF EXISTS `v_movimientos_mark`*/; +/*!50001 DROP VIEW IF EXISTS `v_movimientos_mark`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_movimientos_mark` AS select `Movimientos_mark`.`Id_Movimiento` AS `Id_Movimiento`,max(`Movimientos_mark`.`Id_Accion`) AS `Accion` from `Movimientos_mark` group by `Movimientos_mark`.`Id_Movimiento` having ((max(`Movimientos_mark`.`Id_Accion`) = '6') or (max(`Movimientos_mark`.`Id_Accion`) = '7')) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_pedidos_auto_preparados` +-- + +/*!50001 DROP TABLE IF EXISTS `v_pedidos_auto_preparados`*/; +/*!50001 DROP VIEW IF EXISTS `v_pedidos_auto_preparados`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_pedidos_auto_preparados` AS select `t`.`CodigoTrabajador` AS `CodigoTrabajador`,`i`.`Id_Ticket` AS `Id_Ticket`,`i`.`odbc_date` AS `Momento` from ((`vn2008`.`v_jerarquia` `j` left join `vn2008`.`v_inter` `i` on((`j`.`Id_Trabajador` = `i`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `j`.`Id_Trabajador`))) where (`i`.`state_id` = 20) */; +/*!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_pedidos_auto_preparadoskk` +-- + +/*!50001 DROP TABLE IF EXISTS `v_pedidos_auto_preparadoskk`*/; +/*!50001 DROP VIEW IF EXISTS `v_pedidos_auto_preparadoskk`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_pedidos_auto_preparadoskk` AS select `t`.`CodigoTrabajador` AS `CodigoTrabajador`,`TK`.`Fecha` AS `Fecha`,`TK`.`Id_Ticket` AS `Id_Ticket`,`i`.`odbc_date` AS `Momento` from (((`vn2008`.`v_jerarquia` `j` left join `vn2008`.`v_inter` `i` on((`j`.`Id_Trabajador` = `i`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `j`.`Id_Trabajador`))) left join `vn2008`.`Tickets` `TK` on((`TK`.`Id_Ticket` = `i`.`Id_Ticket`))) where (`i`.`state_id` = 5) */; +/*!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_phonebook` +-- + +/*!50001 DROP TABLE IF EXISTS `v_phonebook`*/; +/*!50001 DROP VIEW IF EXISTS `v_phonebook`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_phonebook` AS select `Clientes`.`id_cliente` AS `Id_Cliente`,replace(`Clientes`.`telefono`,' ','') AS `Telefono` from `Clientes` where (`Clientes`.`telefono` and `Clientes`.`activo`) union select `Clientes`.`id_cliente` AS `Id_Cliente`,replace(`Clientes`.`movil`,' ','') AS `Movil` from `Clientes` where (`Clientes`.`movil` and `Clientes`.`activo`) union select `Consignatarios`.`Id_cliente` AS `Id_Cliente`,replace(`Consignatarios`.`telefono`,' ','') AS `TRIM(telefono)` from (`Consignatarios` join `Clientes` `c` on((`Consignatarios`.`Id_cliente` = `c`.`id_cliente`))) where (`Consignatarios`.`telefono` and `c`.`activo`) union select `Consignatarios`.`Id_cliente` AS `Id_Cliente`,replace(`Consignatarios`.`movil`,' ','') AS `TRIM(movil)` from (`Consignatarios` join `Clientes` `c` on((`Consignatarios`.`Id_cliente` = `c`.`id_cliente`))) where (`Consignatarios`.`movil` and `c`.`activo`) union select `r`.`Id_Cliente` AS `Id_Cliente`,replace(`c`.`Telefono`,' ','') AS `REPLACE(c.telefono,' ','')` from ((`Clientes` `cl` join `Relaciones` `r` on((`cl`.`id_cliente` = `r`.`Id_Cliente`))) join `Contactos` `c` on((`r`.`Id_Contacto` = `c`.`Id_Contacto`))) where (`cl`.`telefono` and `cl`.`activo`) union select `r`.`Id_Cliente` AS `Id_Cliente`,replace(`c`.`Movil`,' ','') AS `REPLACE(c.Movil,' ','')` from ((`Clientes` `cl` join `Relaciones` `r` on((`cl`.`id_cliente` = `r`.`Id_Cliente`))) join `Contactos` `c` on((`r`.`Id_Contacto` = `c`.`Id_Contacto`))) where (`cl`.`movil` and `cl`.`activo`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_price_fixed` +-- + +/*!50001 DROP TABLE IF EXISTS `v_price_fixed`*/; +/*!50001 DROP VIEW IF EXISTS `v_price_fixed`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_price_fixed` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `price_fixed` `pf` where (`pf`.`warehouse_id` < 1000) union all select `wg`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from (`price_fixed` `pf` join `warehouse_group` `wg`) where ((`wg`.`warehouse_alias_id` + 1000) = `pf`.`warehouse_id`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_price_fixed_group` +-- + +/*!50001 DROP TABLE IF EXISTS `v_price_fixed_group`*/; +/*!50001 DROP VIEW IF EXISTS `v_price_fixed_group`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_price_fixed_group` AS select `pf`.`warehouse_id` AS `warehouse_id`,`pf`.`item_id` AS `item_id`,`pf`.`rate_0` AS `rate_0`,`pf`.`rate_1` AS `rate_1`,`pf`.`rate_2` AS `rate_2`,`pf`.`rate_3` AS `rate_3`,`pf`.`date_start` AS `date_start`,`pf`.`date_end` AS `date_end`,`pf`.`bonus` AS `bonus`,`pf`.`grouping` AS `grouping`,`pf`.`Packing` AS `Packing`,`pf`.`caja` AS `caja` from `v_price_fixed` `pf` group by `pf`.`warehouse_id`,`pf`.`item_id`,`pf`.`date_start`,`pf`.`date_end` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_session` +-- + +/*!50001 DROP TABLE IF EXISTS `v_session`*/; +/*!50001 DROP VIEW IF EXISTS `v_session`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_session` AS select 1 AS `id`,`t`.`CodigoTrabajador` AS `CodigoTrabajador`,if(isnull(`sc`.`Id_Suplente`),`c`.`Id_Trabajador`,`sc`.`Id_Suplente`) AS `Id_Trabajador`,`c`.`id_cliente` AS `Id_Cliente`,`c`.`cliente` AS `Cliente`,`s`.`lastUpdate` AS `Fecha` from ((((`hedera`.`userSession` `s` join `hedera`.`visitUser` `v` on((`v`.`id` = `s`.`userVisit`))) join `vn2008`.`Clientes` `c` on((`c`.`id_cliente` = `v`.`user`))) left join `vn2008`.`Trabajadores` `t` on((`c`.`Id_Trabajador` = `t`.`Id_Trabajador`))) left join `vn2008`.`sharingcart` `sc` on(((`sc`.`Id_Trabajador` = `c`.`Id_Trabajador`) and (curdate() between `sc`.`datSTART` and `sc`.`datEND`)))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_ticket_amount` +-- + +/*!50001 DROP TABLE IF EXISTS `v_ticket_amount`*/; +/*!50001 DROP VIEW IF EXISTS `v_ticket_amount`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_ticket_amount` AS select `Movimientos`.`Id_Ticket` AS `Id_Ticket`,sum((((`Movimientos`.`Cantidad` * `Movimientos`.`Preu`) * (100 - `Movimientos`.`Descuento`)) / 100)) AS `amount` from (`Movimientos` join `Tickets` on((`Movimientos`.`Id_Ticket` = `Tickets`.`Id_Ticket`))) where (`Tickets`.`Fecha` >= (curdate() + interval -(6) month)) group by `Movimientos`.`Id_Ticket` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_trabajadores` +-- + +/*!50001 DROP TABLE IF EXISTS `v_trabajadores`*/; +/*!50001 DROP VIEW IF EXISTS `v_trabajadores`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_trabajadores` AS select `t`.`CodigoTrabajador` AS `CodigoTrabajador`,`t`.`Nombre` AS `Nombre`,`t`.`Fecha_Inicio` AS `Fecha_Inicio`,`t`.`Password` AS `Password`,`t`.`user` AS `user`,`t`.`Apellidos` AS `Apellidos`,`t`.`Id_Trabajador` AS `Id_Trabajador`,`t`.`Foto` AS `Foto` from `vn2008`.`Trabajadores` `t` where (`t`.`Id_Cliente_Interno` = `account`.`userGetId`()) */; +/*!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_user` +-- + +/*!50001 DROP TABLE IF EXISTS `v_user`*/; +/*!50001 DROP VIEW IF EXISTS `v_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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_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` 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 `v_ventes` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 ((((((((`Movimientos` `M` join `Tickets` `T` on((`M`.`Id_Ticket` = `T`.`Id_Ticket`))) join `Consignatarios` `CS` on((`CS`.`id_consigna` = `T`.`Id_Consigna`))) join `Clientes` `C` on((`CS`.`Id_cliente` = `C`.`id_cliente`))) join `Articles` `A` on((`M`.`Id_Article` = `A`.`Id_Article`))) join `Origen` `O` on((`O`.`id` = `A`.`id_origen`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) join `reinos` `r` on((`TP`.`reino_id` = `r`.`id`))) join `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_venteskk` +-- + +/*!50001 DROP TABLE IF EXISTS `v_venteskk`*/; +/*!50001 DROP VIEW IF EXISTS `v_venteskk`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_venteskk` 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 ((((((((`Movimientos` `M` join `Tickets` `T` on((`M`.`Id_Ticket` = `T`.`Id_Ticket`))) join `Consignatarios` `CS` on((`CS`.`id_consigna` = `T`.`Id_Consigna`))) join `Clientes` `C` on((`CS`.`Id_cliente` = `C`.`id_cliente`))) join `Articles` `A` on((`M`.`Id_Article` = `A`.`Id_Article`))) join `Origen` `O` on((`O`.`id` = `A`.`id_origen`))) join `Tipos` `TP` on((`A`.`tipo_id` = `TP`.`tipo_id`))) join `reinos` `r` on((`TP`.`reino_id` = `r`.`id`))) join `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_warehouse` +-- + +/*!50001 DROP TABLE IF EXISTS `v_warehouse`*/; +/*!50001 DROP VIEW IF EXISTS `v_warehouse`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `warehouse` union all select (1000 + `warehouse_alias`.`warehouse_alias_id`) AS `warehouse_alias_id`,concat(`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `warehouse_alias` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_xsubclien` +-- + +/*!50001 DROP TABLE IF EXISTS `v_xsubclien`*/; +/*!50001 DROP VIEW IF EXISTS `v_xsubclien`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_xsubclien` AS select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `Facturas` where (`Facturas`.`Fecha` > (curdate() + interval -(2) month)) union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `Recibos` where (`Recibos`.`Fechacobro` > (curdate() + interval -(2) month)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_xsubcuentas` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if((`p`.`CEE` = 1),`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`v_xsubclien`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,(coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1)) AS `EMAIL`,if((`p`.`CEE` = 0),1,if((`p`.`CEE` = 1),2,4)) AS `IDNIF` from (((`Clientes` join `v_xsubclien` on((`Clientes`.`id_cliente` = `v_xsubclien`.`Id_Cliente`))) left join `Paises` `p` on((`p`.`Id` = `Clientes`.`Id_Pais`))) join `province` on((`Clientes`.`province_id` = `province`.`province_id`))) where (`Clientes`.`oficial` <> 0) group by `Clientes`.`id_cliente`,`v_xsubclien`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if((`p`.`CEE` = 1),`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`CP` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,(coalesce(nullif(locate(',',`c`.`email`),0),99) - 1)) AS `EMAIL`,if((`p`.`CEE` = 0),1,if((`p`.`CEE` = 1),2,4)) AS `IDNIF` from (((((`Proveedores` join `v_xsubprov` on((`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`))) left join `Paises` `p` on((`p`.`Id` = `Proveedores`.`pais_id`))) left join `province` `prov` on((`prov`.`province_id` = `Proveedores`.`province_id`))) left join `Relaciones` `r` on((`r`.`Id_Proveedor` = `Proveedores`.`Id_Proveedor`))) left join `Contactos` `c` on((`c`.`Id_Contacto` = `r`.`Id_Contacto`))) where (`Proveedores`.`oficial` <> 0) group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` union all select `Gastos`.`Id_Gasto` AS `Id_Gasto`,`Gastos`.`Gasto` 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 (`Gastos` join `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 (`Bancos` join `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`.`CP` AS `CP`,`p`.`Codigo` AS `country_code`,`v_xsubprov`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,(coalesce(nullif(locate(',',`c`.`email`),0),99) - 1)) AS `EMAIL`,if((`p`.`CEE` = 0),1,if((`p`.`CEE` = 1),2,4)) AS `IDNIF` from (((((`Proveedores` join `v_xsubprov` on((`Proveedores`.`Id_Proveedor` = `v_xsubprov`.`proveedor_id`))) left join `Paises` `p` on((`p`.`Id` = `Proveedores`.`pais_id`))) left join `province` `prov` on((`prov`.`province_id` = `Proveedores`.`province_id`))) left join `Relaciones` `r` on((`r`.`Id_Proveedor` = `Proveedores`.`Id_Proveedor`))) left join `Contactos` `c` on((`c`.`Id_Contacto` = `r`.`Id_Contacto`))) where (((`Proveedores`.`cuenta` like '_____3____') or (`Proveedores`.`cuenta` like '_____2____')) and (`Proveedores`.`oficial` = 1)) group by `v_xsubprov`.`proveedor_id`,`v_xsubprov`.`empresa_id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_xsubprov` +-- + +/*!50001 DROP TABLE IF EXISTS `v_xsubprov`*/; +/*!50001 DROP VIEW IF EXISTS `v_xsubprov`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_xsubprov` AS select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `recibida` where (`recibida`.`fecha` > (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 `pago` where (`pago`.`fecha` > (curdate() + interval -(3) month)) group by `pago`.`id_proveedor`,`pago`.`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 `vnCreditClassification` +-- + +/*!50001 DROP TABLE IF EXISTS `vnCreditClassification`*/; +/*!50001 DROP VIEW IF EXISTS `vnCreditClassification`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `vnCreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `client`,`vn`.`creditClassification`.`dateStart` AS `dateStart`,`vn`.`creditClassification`.`dateEnd` AS `dateEnd` from `vn`.`creditClassification` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `vnCreditInsurance` +-- + +/*!50001 DROP TABLE IF EXISTS `vnCreditInsurance`*/; +/*!50001 DROP VIEW IF EXISTS `vnCreditInsurance`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `vnCreditInsurance` AS select `vn`.`creditInsurance`.`id` AS `id`,`vn`.`creditInsurance`.`creditClassification` AS `creditClassification`,`vn`.`creditInsurance`.`credit` AS `credit`,`vn`.`creditInsurance`.`creationDate` AS `creationDate`,`vn`.`creditInsurance`.`grade` AS `grade` from `vn`.`creditInsurance` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `vnSolunionCAP` +-- + +/*!50001 DROP TABLE IF EXISTS `vnSolunionCAP`*/; +/*!50001 DROP VIEW IF EXISTS `vnSolunionCAP`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `vnSolunionCAP` AS select `vn`.`solunionCAP`.`creditInsurance` AS `creditInsurance`,`vn`.`solunionCAP`.`dateStart` AS `dateStart`,`vn`.`solunionCAP`.`dateEnd` AS `dateEnd`,`vn`.`solunionCAP`.`dateLeaving` AS `dateLeaving` from `vn`.`solunionCAP` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerDocument` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerDocument` AS select `vn`.`workerDocument`.`id` AS `id`,`vn`.`workerDocument`.`worker` AS `worker`,`vn`.`workerDocument`.`document` AS `document` 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 `workerTeamCollegues` +-- + +/*!50001 DROP TABLE IF EXISTS `workerTeamCollegues`*/; +/*!50001 DROP VIEW IF EXISTS `workerTeamCollegues`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`Id_Trabajador` AS `workerId`,`t`.`Id_Trabajador` AS `collegueId` from (`vn`.`workerTeam` `w` join `vn`.`workerTeam` `t` on((`w`.`team` = `t`.`team`))) */; +/*!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_kk` +-- + +/*!50001 DROP TABLE IF EXISTS `workerTeam_kk`*/; +/*!50001 DROP VIEW IF EXISTS `workerTeam_kk`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTeam_kk` AS select `w`.`team` AS `team`,`w`.`user` AS `user`,`w`.`id` AS `id`,`t`.`Id_Trabajador` AS `Id_Trabajador` from (`vn`.`workerTeam` `w` left join `vn2008`.`Trabajadores` `t` on((`t`.`user_id` = `w`.`user`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `zoneNickname` +-- + +/*!50001 DROP TABLE IF EXISTS `zoneNickname`*/; +/*!50001 DROP VIEW IF EXISTS `zoneNickname`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `zoneNickname` AS select `ap`.`warehouse_id` AS `warehouse_id`,`ap`.`agency_id` AS `agency_id`,`ap`.`zona` AS `zona`,concat('ZONA ',`ap`.`zona`,' ',if((`ap`.`zona` = 20),'Madrid',`p`.`name`)) AS `alias` from (`Agencias_province` `ap` join `province` `p` on((`p`.`province_id` = `ap`.`province_id`))) group by `ap`.`zona`,`ap`.`warehouse_id`,`ap`.`agency_id` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Current Database: `vn` +-- + +USE `vn`; + +-- +-- Final view structure for view `accounting` +-- + +/*!50001 DROP TABLE IF EXISTS `accounting`*/; +/*!50001 DROP VIEW IF EXISTS `accounting`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `accounting` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `address` +-- + +/*!50001 DROP TABLE IF EXISTS `address`*/; +/*!50001 DROP VIEW IF EXISTS `address`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `address` AS select `t`.`id_consigna` AS `id`,`t`.`Id_cliente` AS `clientFk`,`t`.`domicilio` AS `street`,`t`.`poblacion` AS `city`,`t`.`codPostal` AS `postalCode`,`t`.`province_id` AS `provinceFk`,`t`.`telefono` AS `phone`,`t`.`movil` AS `mobile`,`t`.`consignatario` AS `nickname`,`t`.`predeterminada` AS `isDefaultAddress`,`t`.`longitude` AS `longitude`,`t`.`latitude` AS `latitude`,`t`.`warehouse_id` AS `warehouseFk`,`t`.`Id_Agencia` AS `agencyFk`,`t`.`isEqualizated` AS `isEqualizated`,`t`.`active` AS `isActive` from `vn2008`.`Consignatarios` `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 `addressObservation` +-- + +/*!50001 DROP TABLE IF EXISTS `addressObservation`*/; +/*!50001 DROP VIEW IF EXISTS `addressObservation`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `addressObservation` AS select `co`.`consignatarios_observation_id` AS `id`,`co`.`Id_Consigna` AS `addressFk`,`co`.`observation_type_id` AS `observationTypeFk`,`co`.`text` AS `description` from `vn2008`.`consignatarios_observation` `co` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `agency` +-- + +/*!50001 DROP TABLE IF EXISTS `agency`*/; +/*!50001 DROP VIEW IF EXISTS `agency`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `agency` AS select `a`.`agency_id` AS `id`,`a`.`name` AS `name`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`por_volumen` AS `isVolumetric`,`a`.`Id_Banco` AS `bankFk`,`a`.`warehouse_alias_id` AS `warehouseAliasFk`,`a`.`propios` AS `own`,`a`.`zone_label` AS `labelZone` from `vn2008`.`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 `agencyHour` +-- + +/*!50001 DROP TABLE IF EXISTS `agencyHour`*/; +/*!50001 DROP VIEW IF EXISTS `agencyHour`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `agencyHour` AS select `h`.`agency_hour_id` AS `id`,`h`.`agency_id` AS `agency`,`h`.`agency_id` AS `agencyFk`,`h`.`week_day` AS `weekDay`,`h`.`warehouse_id` AS `warehouse`,`h`.`warehouse_id` AS `warehouseFk`,`h`.`province_id` AS `province`,`h`.`province_id` AS `provinceFk`,`h`.`subtract_day` AS `substractDay`,`h`.`max_hour` AS `maxHour` from `vn2008`.`agency_hour` `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 `agencyMode` +-- + +/*!50001 DROP TABLE IF EXISTS `agencyMode`*/; +/*!50001 DROP VIEW IF EXISTS `agencyMode`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `agencyMode` AS select `a`.`Id_Agencia` AS `id`,`a`.`Agencia` AS `name`,`a`.`description` AS `description`,`a`.`Vista` AS `deliveryMethodFk`,`a`.`Vista` AS `deliveryMethod`,`a`.`Vista` AS `view`,`a`.`m3` AS `m3`,`a`.`cod71` AS `cod71`,`a`.`web` AS `web`,`a`.`agency_id` AS `agencyFk`,`a`.`agency_id` AS `agency`,`a`.`agency_service_id` AS `agencyServiceFk`,`a`.`agency_service_id` AS `agencyService`,`a`.`inflacion` AS `inflation`,`a`.`inflacion` AS `inflacion`,`a`.`is_volumetric` AS `isVolumetric`,`a`.`send_mail` AS `reportMail` from `vn2008`.`Agencias` `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 `agencyWarehouse` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 `awb` +-- + +/*!50001 DROP TABLE IF EXISTS `awb`*/; +/*!50001 DROP VIEW IF EXISTS `awb`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb` AS select `a`.`id` AS `id`,`a`.`codigo` AS `code`,`a`.`bultos` AS `package`,`a`.`peso` AS `weight`,`a`.`MYSQL_TIME` AS `created`,`a`.`transitario_id` AS `transitoryFk`,`a`.`iva_id` AS `taxFk`,`a`.`gestdoc_id` AS `docFk`,`a`.`importe` AS `amount`,`a`.`carguera_id` AS `freightFk`,`a`.`m3` AS `m3`,`a`.`stems` AS `stems`,`a`.`flight_id` AS `flightFk`,`a`.`volume_weight` AS `volumeWeight`,`a`.`hb` AS `hb`,`a`.`rate` AS `rate`,`a`.`booked` AS `booked`,`a`.`issued` AS `issued`,`a`.`operated` AS `operated`,`a`.`bookEntried` AS `bookEntried`,`a`.`invoiceInFk` AS `invoiceInFk`,`a`.`isChecked` AS `isChecked` from `vn2008`.`awb` `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 `bank` +-- + +/*!50001 DROP TABLE IF EXISTS `bank`*/; +/*!50001 DROP VIEW IF EXISTS `bank`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `bank` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `cash`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `bankEntity` +-- + +/*!50001 DROP TABLE IF EXISTS `bankEntity`*/; +/*!50001 DROP VIEW IF EXISTS `bankEntity`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `bankEntity` AS select `e`.`entity_id` AS `id`,`e`.`pais_id` AS `countryFk`,`e`.`description` AS `name`,`e`.`bic` AS `bic` from `vn2008`.`entity` `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 `botanicExport` +-- + +/*!50001 DROP TABLE IF EXISTS `botanicExport`*/; +/*!50001 DROP VIEW IF EXISTS `botanicExport`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description` from `vn2008`.`botanic_export` `be` */; +/*!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` +-- + +/*!50001 DROP TABLE IF EXISTS `buy`*/; +/*!50001 DROP VIEW IF EXISTS `buy`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy` AS select `c`.`Id_Compra` AS `id`,`c`.`Id_Entrada` AS `entryFk`,`c`.`Id_Article` AS `itemFk`,`c`.`Cantidad` AS `amount`,`c`.`Costefijo` AS `buyingValue`,`c`.`Cantidad` AS `quantity`,`c`.`Id_Cubo` AS `packageFk`,`c`.`Etiquetas` AS `stickers`,`c`.`Portefijo` AS `freightValue`,`c`.`Embalajefijo` AS `packageValue`,`c`.`Comisionfija` AS `comissionValue`,`c`.`Packing` AS `packing`,`c`.`grouping` AS `grouping`,`c`.`caja` AS `groupingMode`,`c`.`Nicho` AS `location`,`c`.`Tarifa1` AS `price1`,`c`.`Tarifa2` AS `price2`,`c`.`Tarifa3` AS `price3`,`c`.`PVP` AS `minPrice`,`c`.`Productor` AS `producer`,`c`.`Vida` AS `printedStickers`,`c`.`punteo` AS `isChecked` from `vn2008`.`Compres` `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 `city` +-- + +/*!50001 DROP TABLE IF EXISTS `city`*/; +/*!50001 DROP VIEW IF EXISTS `city`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `city` AS select `c`.`city_id` AS `id`,`c`.`name` AS `name`,`c`.`province_id` AS `provinceFk` from `vn2008`.`city` `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 `client` +-- + +/*!50001 DROP TABLE IF EXISTS `client`*/; +/*!50001 DROP VIEW IF EXISTS `client`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`real` AS `isRelevant`,`c`.`e-mail` AS `email`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`Cuenta` AS `accountingAccount`,`c`.`RE` AS `isEqualizated`,`c`.`province_id` AS `provinceFk`,`c`.`invoice` AS `hasToInvoice`,`c`.`credito` AS `credit`,`c`.`Id_Pais` AS `countryFk`,`c`.`activo` AS `isActive`,`c`.`gestdoc_id` AS `gestdocFk`,`c`.`calidad` AS `quality`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`created` AS `created`,`c`.`mail` AS `isToBeMailed`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `hasSepaVnl`,`c`.`coreVnl` AS `hasCoreVnl`,`c`.`coreVnh` AS `hasCoreVnh`,`c`.`default_address` AS `defaultAddressFk`,`c`.`risk_calculated` AS `riskCalculated`,`c`.`clientes_tipo_id` AS `clientTypeFk`,`c`.`mail_address` AS `mailAddress`,`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress`,`c`.`contabilizado` AS `isTaxDataChecked`,`c`.`congelado` AS `isFreezed`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`isCreatedAsServed` AS `isCreatedAsServed`,`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`vies` AS `isVies`,`c`.`EYPBC` AS `eypbc` from `vn2008`.`Clientes` `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 `clientCredit` +-- + +/*!50001 DROP TABLE IF EXISTS `clientCredit`*/; +/*!50001 DROP VIEW IF EXISTS `clientCredit`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientCredit` AS select `c`.`id` AS `id`,`c`.`Id_Cliente` AS `clientFk`,`c`.`Id_Trabajador` AS `workerFk`,`c`.`Id_Trabajador` AS `__employeeFk`,`c`.`amount` AS `amount`,`c`.`odbc_date` AS `created` from `vn2008`.`credit` `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 `clientDefaultCompany` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 `clientManaCache` +-- + +/*!50001 DROP TABLE IF EXISTS `clientManaCache`*/; +/*!50001 DROP VIEW IF EXISTS `clientManaCache`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientManaCache` AS select `mc`.`Id_Cliente` AS `clientFk`,`mc`.`Mana` AS `mana`,`mc`.`dated` AS `dated` from `bs`.`manaCustomer` `mc` */; +/*!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 `clientNotification` +-- + +/*!50001 DROP TABLE IF EXISTS `clientNotification`*/; +/*!50001 DROP VIEW IF EXISTS `clientNotification`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientNotification` AS select `e`.`id` AS `id`,`e`.`Id_Cliente` AS `clientFk`,`e`.`escritos_id` AS `clientNotificationTypeFk`,`e`.`fecha` AS `created`,`e`.`Id_Trabajador` AS `workerFk`,`e`.`userFk` AS `userFk` from `vn2008`.`escritos_det` `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 `clientNotificationType` +-- + +/*!50001 DROP TABLE IF EXISTS `clientNotificationType`*/; +/*!50001 DROP VIEW IF EXISTS `clientNotificationType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientNotificationType` AS select `e`.`id` AS `id`,`e`.`abrev` AS `code`,`e`.`descripcion` AS `description`,`e`.`visible` AS `isVisible` from `vn2008`.`escritos` `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 `clientObservation` +-- + +/*!50001 DROP TABLE IF EXISTS `clientObservation`*/; +/*!50001 DROP VIEW IF EXISTS `clientObservation`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientObservation` AS select `t`.`client_observation_id` AS `id`,`t`.`Id_Cliente` AS `clientFk`,`t`.`Id_Trabajador` AS `workerFk`,`t`.`text` AS `text`,`t`.`odbc_date` AS `created` from `vn2008`.`client_observation` `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 `clientType` +-- + +/*!50001 DROP TABLE IF EXISTS `clientType`*/; +/*!50001 DROP VIEW IF EXISTS `clientType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type` from `vn2008`.`clientes_tipo` `ct` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `color` +-- + +/*!50001 DROP TABLE IF EXISTS `color`*/; +/*!50001 DROP VIEW IF EXISTS `color`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `color` AS select `c`.`Id_Color` AS `id`,`c`.`Color` AS `name` from `vn2008`.`Colores` `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 `company` +-- + +/*!50001 DROP TABLE IF EXISTS `company`*/; +/*!50001 DROP VIEW IF EXISTS `company`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `company` AS select `e`.`id` AS `id`,`e`.`abbreviation` AS `code`,`e`.`Id_Proveedores_account` AS `supplierAccountFk`,`e`.`CodigoEmpresa` AS `CodigoEmpresa` from `vn2008`.`empresa` `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 `comparative` +-- + +/*!50001 DROP TABLE IF EXISTS `comparative`*/; +/*!50001 DROP VIEW IF EXISTS `comparative`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `comparative` AS select `c`.`Periodo` AS `timePeriod`,`c`.`Id_Article` AS `itemFk`,`c`.`warehouse_id` AS `warehouseFk`,`c`.`Cantidad` AS `quantity`,`c`.`price` AS `price` from `vn2008`.`Comparativa` `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 `comparativeFilter` +-- + +/*!50001 DROP TABLE IF EXISTS `comparativeFilter`*/; +/*!50001 DROP VIEW IF EXISTS `comparativeFilter`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `comparativeFilter` AS select `f`.`id` AS `id`,`f`.`name` AS `name`,`f`.`sql` AS `whereSql` from `vn2008`.`filtros` `f` */; +/*!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 `contactChannel` +-- + +/*!50001 DROP TABLE IF EXISTS `contactChannel`*/; +/*!50001 DROP VIEW IF EXISTS `contactChannel`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `contactChannel` AS select `c`.`chanel_id` AS `id`,`c`.`name` AS `name` from `vn2008`.`chanel` `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 `country` +-- + +/*!50001 DROP TABLE IF EXISTS `country`*/; +/*!50001 DROP VIEW IF EXISTS `country`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `country` AS select `p`.`Id` AS `id`,`p`.`Pais` AS `country`,`p`.`CEE` AS `CEE`,if((`p`.`CEE` < 2),1,0) AS `isUeeMember`,`p`.`Codigo` AS `code`,`p`.`Id_Moneda` AS `currencyFk`,`p`.`Id_Paisreal` AS `politicalCountryFk`,`p`.`geoFk` AS `geoFk` from `vn2008`.`Paises` `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 `currency` +-- + +/*!50001 DROP TABLE IF EXISTS `currency`*/; +/*!50001 DROP VIEW IF EXISTS `currency`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `currency` AS select `m`.`Id_Moneda` AS `id`,`m`.`Moneda` AS `code`,`m`.`Descripcion` AS `name` from `vn2008`.`Monedas` `m` */; +/*!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 `deliveryMethod` +-- + +/*!50001 DROP TABLE IF EXISTS `deliveryMethod`*/; +/*!50001 DROP VIEW IF EXISTS `deliveryMethod`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `deliveryMethod` AS select `d`.`vista_id` AS `id`,`d`.`code` AS `code`,`d`.`vista` AS `description` from `vn2008`.`Vistas` `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 `ediGenus` +-- + +/*!50001 DROP TABLE IF EXISTS `ediGenus`*/; +/*!50001 DROP VIEW IF EXISTS `ediGenus`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ediGenus` AS select `g`.`genus_id` AS `id`,`g`.`latin_genus_name` AS `latinGenusName`,`g`.`entry_date` AS `entried`,`g`.`expiry_date` AS `dued`,`g`.`change_date_time` AS `modified` from `edi`.`genus` `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 `ediSpecie` +-- + +/*!50001 DROP TABLE IF EXISTS `ediSpecie`*/; +/*!50001 DROP VIEW IF EXISTS `ediSpecie`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ediSpecie` AS select `s`.`specie_id` AS `id`,`s`.`genus_id` AS `genusFk`,`s`.`latin_species_name` AS `latinSpeciesName`,`s`.`entry_date` AS `entried`,`s`.`expiry_date` AS `dued`,`s`.`change_date_time` AS `modified` from `edi`.`specie` `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 `entity` +-- + +/*!50001 DROP TABLE IF EXISTS `entity`*/; +/*!50001 DROP VIEW IF EXISTS `entity`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `entity` AS select `e`.`pais_id` AS `countryFk`,`e`.`entity_id` AS `id`,`e`.`description` AS `description`,`e`.`bic` AS `bic` from `vn2008`.`entity` `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 `entry` +-- + +/*!50001 DROP TABLE IF EXISTS `entry`*/; +/*!50001 DROP VIEW IF EXISTS `entry`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `entry` AS select `e`.`Id_Entrada` AS `id`,`e`.`Id_Proveedor` AS `supplierFk`,`e`.`Referencia` AS `ref`,`e`.`Inventario` AS `isInventory`,`e`.`Confirmada` AS `isConfirmed`,`e`.`Pedida` AS `isOrdered`,`e`.`Redada` AS `isRaid`,`e`.`comision` AS `commission`,`e`.`odbc_date` AS `created`,`e`.`Notas_Eva` AS `evaNotes`,`e`.`travel_id` AS `travelFk`,`e`.`Id_Moneda` AS `currencyFk`,`e`.`empresa_id` AS `companyFk`,`e`.`gestdoc_id` AS `gestDocFk`,`e`.`recibida_id` AS `invoiceReceivedFk` from `vn2008`.`Entradas` `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 `especialPrice` +-- + +/*!50001 DROP TABLE IF EXISTS `especialPrice`*/; +/*!50001 DROP VIEW IF EXISTS `especialPrice`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `especialPrice` AS select `p`.`Id_PrecioEspecial` AS `id`,`p`.`Id_Cliente` AS `clientFk`,`p`.`Id_Article` AS `itemFk`,`p`.`PrecioEspecial` AS `value` from `vn2008`.`PreciosEspeciales` `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 `expedition` +-- + +/*!50001 DROP TABLE IF EXISTS `expedition`*/; +/*!50001 DROP VIEW IF EXISTS `expedition`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `expedition` AS select `e`.`expeditions_id` AS `id`,`e`.`agency_id` AS `agency`,`e`.`agency_id` AS `agencyFk`,`e`.`agency_id` AS `agencyModeFk`,`e`.`ticket_id` AS `ticket`,`e`.`ticket_id` AS `ticketFk`,`e`.`EsBulto` AS `isBox`,`e`.`odbc_date` AS `printingTime`,`e`.`Id_Article` AS `item`,`e`.`Id_Article` AS `itemFk`,`e`.`counter` AS `counter`,`e`.`checked` AS `checked`,`e`.`workerFk` AS `workerFk` from `vn2008`.`expeditions` `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 `expence` +-- + +/*!50001 DROP TABLE IF EXISTS `expence`*/; +/*!50001 DROP VIEW IF EXISTS `expence`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `expence` AS select `g`.`Id_Gasto` AS `id`,`g`.`iva_tipo_id` AS `taxTypeFk`,`g`.`Gasto` AS `name`,`g`.`isWithheld` AS `isWithheld` from `vn2008`.`Gastos` `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 `firstTicketShipped` +-- + +/*!50001 DROP TABLE IF EXISTS `firstTicketShipped`*/; +/*!50001 DROP VIEW IF EXISTS `firstTicketShipped`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `firstTicketShipped` AS select min(`ticket`.`shipped`) AS `shipped`,`ticket`.`clientFk` AS `clientFk` from `vn`.`ticket` where (`ticket`.`shipped` > '2001-01-01') group by `ticket`.`clientFk` */; +/*!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 `grant` +-- + +/*!50001 DROP TABLE IF EXISTS `grant`*/; +/*!50001 DROP VIEW IF EXISTS `grant`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `grant` AS select `vn2008`.`Permisos`.`Id_Grupo` AS `group`,`vn2008`.`Permisos`.`Id_Trabajador` AS `worker`,`vn2008`.`Permisos`.`empresa_id` AS `company` from `vn2008`.`Permisos` */; +/*!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 `grantGroup` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `grantGroup` AS select `vn2008`.`Grupos`.`id` AS `id`,`vn2008`.`Grupos`.`Grupo` AS `description`,`vn2008`.`Grupos`.`observation_type_id` AS `observationType` 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 `greuge` +-- + +/*!50001 DROP TABLE IF EXISTS `greuge`*/; +/*!50001 DROP VIEW IF EXISTS `greuge`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `greuge` AS select `g`.`Id` AS `id`,`g`.`Id_Cliente` AS `clientFk`,`g`.`Comentario` AS `description`,`g`.`Importe` AS `amount`,`g`.`Fecha` AS `shipped`,`g`.`odbc_date` AS `created`,`g`.`Greuges_type_id` AS `greugeTypeFk`,`g`.`Id_Ticket` AS `ticketFk` from `vn2008`.`Greuges` `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 `greugeType` +-- + +/*!50001 DROP TABLE IF EXISTS `greugeType`*/; +/*!50001 DROP VIEW IF EXISTS `greugeType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `greugeType` AS select `gt`.`Greuges_type_id` AS `id`,`gt`.`name` AS `name` from `vn2008`.`Greuges_type` `gt` */; +/*!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 `ink` +-- + +/*!50001 DROP TABLE IF EXISTS `ink`*/; +/*!50001 DROP VIEW IF EXISTS `ink`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ink` AS select `c`.`Id_Tinta` AS `id`,`c`.`name` AS `name`,`c`.`Tinta` AS `picture`,`c`.`Orden` AS `showOrder` from `vn2008`.`Tintas` `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 `inkL10n` +-- + +/*!50001 DROP TABLE IF EXISTS `inkL10n`*/; +/*!50001 DROP VIEW IF EXISTS `inkL10n`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `inkL10n` AS select `k`.`id` AS `id`,ifnull(`i`.`name`,`k`.`name`) AS `name` from (`vn`.`ink` `k` left join `vn`.`inkI18n` `i` on(((`i`.`inkFk` = `k`.`id`) and (`i`.`lang` = `util`.`lang`())))) */; +/*!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` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `intrastat` AS select `i`.`Codintrastat` AS `id`,`i`.`Definicion` AS `description`,`i`.`iva_group_id` AS `taxClassFk`,`i`.`iva_codigo_id` AS `taxCodeFk` from `vn2008`.`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 `invoiceCorrection` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceCorrection` AS select `ic`.`correctingFk` AS `correctingFk`,`ic`.`correctedFk` AS `correctedFk`,`ic`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`ic`.`cplusInvoiceType477Fk` AS `cplusInvoiceType477Fk`,`ic`.`invoiceCorrectionTypeFk` AS `invoiceCorrectionTypeFk` from `vn2008`.`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 `invoiceCorrectionDataSource` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceCorrectionDataSource`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceCorrectionDataSource`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceCorrectionDataSource` AS select `s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`s`.`price` AS `price`,`s`.`discount` AS `discount`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`t`.`shipped` AS `shipped` from (`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) */; +/*!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 `invoiceIn` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceIn`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceIn`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceIn` AS select `r`.`id` AS `id`,`r`.`num_recibida` AS `serialNumber`,`r`.`serie` AS `serial`,`r`.`proveedor_id` AS `supplierFk`,`r`.`fecha` AS `issued`,`r`.`sref` AS `supplierRef`,`r`.`contabilizada` AS `isBooked`,`r`.`moneda_id` AS `currencyFk`,`r`.`MYSQL_TIME` AS `created`,`r`.`empresa_id` AS `companyFk`,`r`.`gestdoc_id` AS `docFk`,`r`.`dateBooking` AS `booked`,`r`.`dateOperation` AS `operated`,`r`.`cplusInvoiceType472Fk` AS `cplusInvoiceType472Fk`,`r`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`r`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`r`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`r`.`cplusTrascendency472Fk` AS `cplusTrascendency472Fk`,`r`.`bookEntried` AS `bookEntried` from `vn2008`.`recibida` `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 `invoiceInAwb` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInAwb`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInAwb`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInAwb` AS select `a`.`recibida_id` AS `invoiceInFk`,`a`.`awb_id` AS `awbFk`,`a`.`dua` AS `dua` from `vn2008`.`awb_recibida` `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 `invoiceInDueDay` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInDueDay`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInDueDay`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInDueDay` AS select `r`.`id` AS `id`,`r`.`recibida_id` AS `invoiceInFk`,`r`.`fecha` AS `dueDated`,`r`.`banco_id` AS `bankFk`,`r`.`cantidad` AS `amount`,`r`.`divisa` AS `divisa`,`r`.`stamp` AS `created` from `vn2008`.`recibida_vencimiento` `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 `invoiceInEntry` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInEntry`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInEntry`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInEntry` AS select `i`.`recibida_entrada_id` AS `id`,`i`.`recibida_id` AS `invoiceInFk`,`i`.`Id_Entrada` AS `entryFk`,`i`.`percentage` AS `percentage`,`i`.`awb_recibida` AS `invoiceInAwbFk`,`i`.`Contabilizado` AS `isBooked` from `vn2008`.`recibida_entrada` `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 `invoiceInIntrastat` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInIntrastat`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInIntrastat` AS select `r`.`recibida_id` AS `invoiceInFk`,`r`.`Codintrastat` AS `intrastatFk`,`r`.`importe` AS `amount` from `vn2008`.`recibida_intrastat` `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 `invoiceInTax` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInTax`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInTax`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInTax` AS select `r`.`id` AS `id`,`r`.`recibida_id` AS `invoiceInFk`,`r`.`iva_id` AS `taxCodeFk`,`r`.`bi` AS `taxableBase`,`r`.`gastos_id` AS `expenceFk`,`r`.`divisa` AS `foreignValue`,`r`.`MYSQL_TIME` AS `created` from `vn2008`.`recibida_iva` `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 `invoiceOut` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceOut`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceOut`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceOut` AS select `f`.`factura_id` AS `id`,`f`.`Id_Factura` AS `ref`,`f`.`Serie` AS `serial`,`f`.`Fecha` AS `issued`,`f`.`Importe` AS `amount`,`f`.`Id_Cliente` AS `clientFk`,`f`.`odbc_date` AS `created`,`f`.`empresa_id` AS `companyFk`,`f`.`Vencimiento` AS `dued`,`f`.`booked` AS `booked`,`f`.`cplusInvoiceType477Fk` AS `cplusInvoiceType477Fk`,`f`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`f`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`f`.`cplusTrascendency477Fk` AS `cplusTrascendency477Fk`,`f`.`pdf` AS `pdf` from `vn2008`.`Facturas` `f` */; +/*!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` +-- + +/*!50001 DROP TABLE IF EXISTS `item`*/; +/*!50001 DROP VIEW IF EXISTS `item`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `item` AS select `t`.`Id_Article` AS `id`,`t`.`Article` AS `name`,`t`.`tipo_id` AS `typeFk`,`t`.`Medida` AS `size`,`t`.`Color` AS `inkFk`,`t`.`Categoria` AS `category`,`t`.`Tallos` AS `stems`,`t`.`id_origen` AS `originFk`,`t`.`description` AS `description`,`t`.`producer_id` AS `producerFk`,`t`.`Codintrastat` AS `intrastatFk`,`t`.`offer` AS `isOnOffer`,`t`.`expenceFk` AS `expenceFk`,`t`.`bargain` AS `isBargain`,`t`.`comments` AS `comment`,`t`.`relevancy` AS `relevancy`,`t`.`Foto` AS `image`,`t`.`iva_group_id` AS `taxClassFk` from `vn2008`.`Articles` `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 `itemBarcode` +-- + +/*!50001 DROP TABLE IF EXISTS `itemBarcode`*/; +/*!50001 DROP VIEW IF EXISTS `itemBarcode`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemBarcode` AS select `vn2008`.`barcodes`.`id` AS `id`,`vn2008`.`barcodes`.`Id_Article` AS `itemFk`,`vn2008`.`barcodes`.`code` AS `code` from `vn2008`.`barcodes` */; +/*!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 `itemBotanical` +-- + +/*!50001 DROP TABLE IF EXISTS `itemBotanical`*/; +/*!50001 DROP VIEW IF EXISTS `itemBotanical`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemBotanical` AS select `ab`.`Id_Article` AS `itemFk`,`ab`.`botanical` AS `botanical`,`ab`.`genus_id` AS `genusFk`,`ab`.`specie_id` AS `specieFk` from `vn2008`.`Articles_botanical` `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 `itemBotanicalWithGenus` +-- + +/*!50001 DROP TABLE IF EXISTS `itemBotanicalWithGenus`*/; +/*!50001 DROP VIEW IF EXISTS `itemBotanicalWithGenus`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,ifnull(`ib`.`botanical`,concat(`g`.`latinGenusName`,' ',ifnull(`s`.`latinSpeciesName`,''))) AS `ediBotanic` from ((`vn`.`itemBotanical` `ib` left join `vn`.`ediGenus` `g` on((`g`.`id` = `ib`.`genusFk`))) left join `vn`.`ediSpecie` `s` on((`s`.`id` = `ib`.`specieFk`))) */; +/*!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 `itemCategory` +-- + +/*!50001 DROP TABLE IF EXISTS `itemCategory`*/; +/*!50001 DROP VIEW IF EXISTS `itemCategory`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemCategory` AS select `r`.`id` AS `id`,`r`.`reino` AS `name`,`r`.`display` AS `display`,`r`.`color` AS `color` from `vn2008`.`reinos` `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 `itemCategoryL10n` +-- + +/*!50001 DROP TABLE IF EXISTS `itemCategoryL10n`*/; +/*!50001 DROP VIEW IF EXISTS `itemCategoryL10n`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemCategoryL10n` AS select `c`.`id` AS `id`,ifnull(`i`.`name`,`c`.`name`) AS `name` from (`vn`.`itemCategory` `c` left join `vn`.`itemCategoryI18n` `i` on(((`i`.`categoryFk` = `c`.`id`) and (`i`.`lang` = `util`.`lang`())))) */; +/*!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 `itemPlacement` +-- + +/*!50001 DROP TABLE IF EXISTS `itemPlacement`*/; +/*!50001 DROP VIEW IF EXISTS `itemPlacement`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemPlacement` AS select `an`.`Id_Article` AS `itemFk`,`an`.`warehouse_id` AS `warehouseFk`,`an`.`nicho` AS `code` from `vn2008`.`Articles_nicho` `an` */; +/*!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 `itemTagged` +-- + +/*!50001 DROP TABLE IF EXISTS `itemTagged`*/; +/*!50001 DROP VIEW IF EXISTS `itemTagged`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemTagged` AS select distinct `itemTag`.`itemFk` AS `itemFk` from `itemTag` */; +/*!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 `itemType` +-- + +/*!50001 DROP TABLE IF EXISTS `itemType`*/; +/*!50001 DROP VIEW IF EXISTS `itemType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemType` AS select `t`.`tipo_id` AS `id`,`t`.`Id_Tipo` AS `code`,`t`.`Tipo` AS `name`,`t`.`reino_id` AS `categoryFk`,`t`.`life` AS `life`,`t`.`Id_Trabajador` AS `workerFk` from `vn2008`.`Tipos` `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 `itemTypeL10n` +-- + +/*!50001 DROP TABLE IF EXISTS `itemTypeL10n`*/; +/*!50001 DROP VIEW IF EXISTS `itemTypeL10n`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemTypeL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`vn`.`itemType` `t` left join `vn`.`itemTypeI18n` `i` on(((`i`.`typeFk` = `t`.`id`) and (`i`.`lang` = `util`.`LANG`())))) */; +/*!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` +-- + +/*!50001 DROP TABLE IF EXISTS `mail`*/; +/*!50001 DROP VIEW IF EXISTS `mail`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mail` AS select `vn2008`.`mail`.`id` AS `id`,`vn2008`.`mail`.`senderFk` AS `senderFk`,`vn2008`.`mail`.`recipientFk` AS `recipientFk`,`vn2008`.`mail`.`to` AS `sender`,`vn2008`.`mail`.`reply_to` AS `replyTo`,`vn2008`.`mail`.`subject` AS `subject`,`vn2008`.`mail`.`text` AS `body`,`vn2008`.`mail`.`plainTextBody` AS `plainTextBody`,`vn2008`.`mail`.`path` AS `attachment`,`vn2008`.`mail`.`DATE_ODBC` AS `creationDate`,`vn2008`.`mail`.`sent` AS `sent`,`vn2008`.`mail`.`error` AS `status` from `vn2008`.`mail` */; +/*!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 `manaSpellers` +-- + +/*!50001 DROP TABLE IF EXISTS `manaSpellers`*/; +/*!50001 DROP VIEW IF EXISTS `manaSpellers`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `manaSpellers` AS select `bs`.`mana_spellers`.`Id_Trabajador` AS `worker`,`bs`.`mana_spellers`.`size` AS `size`,`bs`.`mana_spellers`.`used` AS `used`,`bs`.`mana_spellers`.`prices_modifier_rate` AS `pricesModifierRate`,`bs`.`mana_spellers`.`prices_modifier_activated` AS `pricesModifierActivated`,`vn2008`.`Trabajadores`.`CodigoTrabajador` AS `workerCode`,`vn2008`.`Trabajadores`.`Nombre` AS `firstname`,`vn2008`.`Trabajadores`.`Apellidos` AS `name` from (`bs`.`mana_spellers` join `vn2008`.`Trabajadores` on((`bs`.`mana_spellers`.`Id_Trabajador` = `vn2008`.`Trabajadores`.`Id_Trabajador`))) */; +/*!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 `mandate` +-- + +/*!50001 DROP TABLE IF EXISTS `mandate`*/; +/*!50001 DROP VIEW IF EXISTS `mandate`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mandate` AS select `m`.`id` AS `id`,`m`.`Id_Cliente` AS `clientFk`,`m`.`empresa_id` AS `companyFk`,`m`.`Id_mandato` AS `code`,`m`.`FAlta` AS `created`,`m`.`Fbaja` AS `finished`,`m`.`idmandato_tipo` AS `mandateTypeFk` from `vn2008`.`mandato` `m` */; +/*!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 `mandateType` +-- + +/*!50001 DROP TABLE IF EXISTS `mandateType`*/; +/*!50001 DROP VIEW IF EXISTS `mandateType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mandateType` AS select `m`.`idmandato_tipo` AS `id`,`m`.`Nombre` AS `name` from `vn2008`.`mandato_tipo` `m` */; +/*!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 `movement` +-- + +/*!50001 DROP TABLE IF EXISTS `movement`*/; +/*!50001 DROP VIEW IF EXISTS `movement`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `movement` AS select `m`.`Id_Movimiento` AS `id`,`m`.`Id_Article` AS `item`,`m`.`Id_Ticket` AS `ticket`,`m`.`Concepte` AS `concept`,`m`.`Cantidad` AS `amount`,`m`.`quantity` AS `quantity`,`m`.`Preu` AS `price`,`m`.`Descuento` AS `discount`,`m`.`CostFixat` AS `cost`,`m`.`Reservado` AS `reservado`,`m`.`OK` AS `od`,`m`.`PrecioFijado` AS `priceFixed`,`m`.`odbc_date` AS `lastUpdate` from `vn2008`.`Movimientos` `m` */; +/*!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 `movementkk` +-- + +/*!50001 DROP TABLE IF EXISTS `movementkk`*/; +/*!50001 DROP VIEW IF EXISTS `movementkk`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `movementkk` AS select `m`.`Id_Movimiento` AS `id`,`m`.`Id_Article` AS `item`,`m`.`Id_Ticket` AS `ticket`,`m`.`Concepte` AS `concept`,`m`.`Cantidad` AS `amount`,`m`.`quantity` AS `quantity`,`m`.`Preu` AS `price`,`m`.`Descuento` AS `discount`,`m`.`CostFixat` AS `cost`,`m`.`Reservado` AS `reservado`,`m`.`OK` AS `od`,`m`.`PrecioFijado` AS `priceFixed`,`m`.`odbc_date` AS `lastUpdate` from `vn2008`.`Movimientos` `m` */; +/*!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 `observationType` +-- + +/*!50001 DROP TABLE IF EXISTS `observationType`*/; +/*!50001 DROP VIEW IF EXISTS `observationType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `observationType` AS select `ot`.`observation_type_id` AS `id`,`ot`.`description` AS `description` from `vn2008`.`observation_type` `ot` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `origin` +-- + +/*!50001 DROP TABLE IF EXISTS `origin`*/; +/*!50001 DROP VIEW IF EXISTS `origin`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `origin` AS select `o`.`id` AS `id`,`o`.`Abreviatura` AS `code`,`o`.`Origen` AS `name` from `vn2008`.`Origen` `o` */; +/*!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 `originL10n` +-- + +/*!50001 DROP TABLE IF EXISTS `originL10n`*/; +/*!50001 DROP VIEW IF EXISTS `originL10n`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `originL10n` AS select `o`.`id` AS `id`,ifnull(`i`.`name`,`o`.`name`) AS `name` from (`vn`.`origin` `o` left join `vn`.`originI18n` `i` on(((`i`.`originFk` = `o`.`id`) and (`i`.`lang` = `util`.`lang`())))) */; +/*!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 `outgoingInvoice` +-- + +/*!50001 DROP TABLE IF EXISTS `outgoingInvoice`*/; +/*!50001 DROP VIEW IF EXISTS `outgoingInvoice`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `outgoingInvoice` AS select `vn2008`.`Facturas`.`Id_Factura` AS `id`,`vn2008`.`Facturas`.`Serie` AS `serie`,`vn2008`.`Facturas`.`Fecha` AS `dateInvoice`,`vn2008`.`Facturas`.`Importe` AS `total`,`vn2008`.`Facturas`.`Vencimiento` AS `dueDate`,`vn2008`.`Facturas`.`Id_Banco` AS `bank`,`vn2008`.`Facturas`.`Id_Cliente` AS `client`,`vn2008`.`Facturas`.`Id_Remesa` AS `remittance`,`vn2008`.`Facturas`.`Remesar` AS `remit`,`vn2008`.`Facturas`.`Id_Trabajador` AS `worker`,`vn2008`.`Facturas`.`odbc_date` AS `creationDate`,`vn2008`.`Facturas`.`empresa_id` AS `company`,`vn2008`.`Facturas`.`liquidacion` AS `liquidacion?`,`vn2008`.`Facturas`.`pdf` AS `isPdf` from `vn2008`.`Facturas` */; +/*!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 `package` +-- + +/*!50001 DROP TABLE IF EXISTS `package`*/; +/*!50001 DROP VIEW IF EXISTS `package`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `package` AS select `c`.`Id_Cubo` AS `id`,`c`.`Volumen` AS `volume`,`c`.`X` AS `width`,`c`.`Y` AS `height`,`c`.`Z` AS `depth`,`c`.`Retornable` AS `isPackageReturnable`,`c`.`odbc_date` AS `created`,`c`.`item_id` AS `itemFk`,`c`.`pvp` AS `price` from `vn2008`.`Cubos` `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 `packageEquivalentItem` +-- + +/*!50001 DROP TABLE IF EXISTS `packageEquivalentItem`*/; +/*!50001 DROP VIEW IF EXISTS `packageEquivalentItem`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `packageEquivalentItem` AS select `i`.`itemFk` AS `itemFk`,`ie`.`itemFk` AS `equivalentFk` from ((`vn`.`packageEquivalent` `pe` join `vn`.`package` `i` on((`i`.`id` = `pe`.`packageFk`))) join `vn`.`package` `ie` on((`ie`.`id` = `pe`.`equivalentFk`))) */; +/*!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 `payMethod` +-- + +/*!50001 DROP TABLE IF EXISTS `payMethod`*/; +/*!50001 DROP VIEW IF EXISTS `payMethod`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `payMethod` AS select `t`.`id` AS `id`,`t`.`name` AS `name`,`t`.`graceDays` AS `graceDays`,`t`.`deudaviva` AS `outstandingDebt`,`t`.`ibanRequired` AS `ibanRequired` from `vn2008`.`pay_met` `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 `payment` +-- + +/*!50001 DROP TABLE IF EXISTS `payment`*/; +/*!50001 DROP VIEW IF EXISTS `payment`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `payment` AS select `p`.`id` AS `id`,`p`.`fecha` AS `received`,`p`.`id_proveedor` AS `supplierFk`,`p`.`importe` AS `amount`,`p`.`id_moneda` AS `currencyFk`,`p`.`divisa` AS `divisa`,`p`.`id_banco` AS `bankFk`,`p`.`pay_met_id` AS `payMethod`,`p`.`empresa_id` AS `companyFk`,`p`.`pago_sdc_id` AS `paymentExchangeInsuranceFk`,`p`.`conciliado` AS `isConciliate` from `vn2008`.`pago` `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 `paymentExchangeInsurance` +-- + +/*!50001 DROP TABLE IF EXISTS `paymentExchangeInsurance`*/; +/*!50001 DROP VIEW IF EXISTS `paymentExchangeInsurance`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `paymentExchangeInsurance` AS select `p`.`pago_sdc_id` AS `id`,`p`.`importe` AS `amount`,`p`.`fecha` AS `created`,`p`.`vencimiento` AS `dueDay`,`p`.`entity_id` AS `entityFk`,`p`.`ref` AS `ref`,`p`.`rate` AS `rate`,`p`.`empresa_id` AS `companyFk`,`p`.`financialProductTypefk` AS `financialProductTypefk`,`p`.`upperBarrier` AS `upperBarrier`,`p`.`lowerBarrier` AS `lowerBarrier`,`p`.`strike` AS `strike` from `vn2008`.`pago_sdc` `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 `payrollCenter` +-- + +/*!50001 DROP TABLE IF EXISTS `payrollCenter`*/; +/*!50001 DROP VIEW IF EXISTS `payrollCenter`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `payrollCenter` AS select `b`.`cod_centro` AS `codCenter`,`b`.`Centro` AS `name`,`b`.`nss_cotizacion` AS `nss`,`b`.`domicilio` AS `street`,`b`.`poblacion` AS `city`,`b`.`cp` AS `postcode`,`b`.`empresa_id` AS `companyFk`,`b`.`codempresa` AS `companyCode` from `vn2008`.`payroll_centros` `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 `plantpassport` +-- + +/*!50001 DROP TABLE IF EXISTS `plantpassport`*/; +/*!50001 DROP VIEW IF EXISTS `plantpassport`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `plantpassport` AS select `pp`.`producer_id` AS `producerFk`,`pp`.`plantpassport_authority_id` AS `plantpassportAuthorityFk`,`pp`.`number` AS `number` from `vn2008`.`plantpassport` `pp` */; +/*!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 `plantpassportAuthority` +-- + +/*!50001 DROP TABLE IF EXISTS `plantpassportAuthority`*/; +/*!50001 DROP VIEW IF EXISTS `plantpassportAuthority`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `plantpassportAuthority` AS select `ppa`.`plantpassport_authority_id` AS `id`,`ppa`.`denomination` AS `denomination`,`ppa`.`Paises_Id` AS `countryFk` from `vn2008`.`plantpassport_authority` `ppa` */; +/*!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 `priceFixed` +-- + +/*!50001 DROP TABLE IF EXISTS `priceFixed`*/; +/*!50001 DROP VIEW IF EXISTS `priceFixed`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `priceFixed` AS select `p`.`item_id` AS `itemFk`,`p`.`rate_0` AS `rate0`,`p`.`rate_1` AS `rate1`,`p`.`rate_2` AS `rate2`,`p`.`rate_3` AS `rate3`,`p`.`date_start` AS `started`,`p`.`date_end` AS `ended`,`p`.`bonus` AS `bonus`,`p`.`warehouse_id` AS `warehouseFk`,`p`.`odbc_date` AS `created`,`p`.`price_fixed_id` AS `id`,`p`.`grouping` AS `grouping`,`p`.`Packing` AS `packing`,`p`.`caja` AS `box` from `vn2008`.`price_fixed` `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 `printServerQueue` +-- + +/*!50001 DROP TABLE IF EXISTS `printServerQueue`*/; +/*!50001 DROP VIEW IF EXISTS `printServerQueue`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `printServerQueue` AS select `c`.`Id_Cola` AS `id`,`c`.`Id_Impresora` AS `printerFk`,`c`.`Id_Prioridad` AS `priorityFk`,`c`.`Id_Informe` AS `reportFk`,`c`.`Id_Estado` AS `statusFk`,`c`.`Hora_Inicio` AS `started`,`c`.`Hora_Fin` AS `finished`,`c`.`Cola` AS `param1`,`c`.`Id_Trabajador` AS `workerFk`,`c`.`Cola2` AS `param2`,`c`.`Cola3` AS `param3`,`c`.`error` AS `error` from `vn2008`.`Colas` `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 `printingQueue` +-- + +/*!50001 DROP TABLE IF EXISTS `printingQueue`*/; +/*!50001 DROP VIEW IF EXISTS `printingQueue`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `printingQueue` AS select `c`.`Id_Cola` AS `id`,`c`.`Id_Impresora` AS `printer`,`c`.`Id_Prioridad` AS `priority`,`c`.`Id_Informe` AS `report`,`c`.`Id_Estado` AS `state`,`c`.`Hora_Inicio` AS `startingTime`,`c`.`Hora_Fin` AS `endingTime`,`c`.`Cola` AS `text`,`c`.`Id_Trabajador` AS `worker`,`c`.`Cola2` AS `text2`,`c`.`Cola3` AS `text3` from `vn2008`.`Colas` `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 `producer` +-- + +/*!50001 DROP TABLE IF EXISTS `producer`*/; +/*!50001 DROP VIEW IF EXISTS `producer`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `producer` AS select `p`.`producer_id` AS `id`,`p`.`name` AS `name` from `vn2008`.`producer` `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 `promissoryNote` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` 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 `province` +-- + +/*!50001 DROP TABLE IF EXISTS `province`*/; +/*!50001 DROP VIEW IF EXISTS `province`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `province` AS select `t`.`province_id` AS `id`,`t`.`name` AS `name`,`t`.`Paises_Id` AS `countryFk`,`t`.`warehouse_id` AS `warehouseFk`,`t`.`zone` AS `zoneFk`,`t`.`geoFk` AS `geoFk` from `vn2008`.`province` `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 `receipt` +-- + +/*!50001 DROP TABLE IF EXISTS `receipt`*/; +/*!50001 DROP VIEW IF EXISTS `receipt`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `receipt` AS select `t`.`Id` AS `Id`,`t`.`Id_Factura` AS `invoiceFk`,`t`.`Entregado` AS `amountPaid`,`t`.`Pendiente` AS `amountUnpaid`,`t`.`Fechacobro` AS `payed`,`t`.`Id_Trabajador` AS `workerFk`,`t`.`Id_Banco` AS `bankFk`,`t`.`Id_Cliente` AS `clientFk`,`t`.`odbc_date` AS `created`,`t`.`empresa_id` AS `companyFk`,`t`.`conciliado` AS `isConciliate` from `vn2008`.`Recibos` `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 `referenceRate` +-- + +/*!50001 DROP TABLE IF EXISTS `referenceRate`*/; +/*!50001 DROP VIEW IF EXISTS `referenceRate`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `referenceRate` AS select `r`.`moneda_id` AS `currencyFk`,`r`.`date` AS `dated`,`r`.`rate` AS `value` from `vn2008`.`reference_rate` `r` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `role` +-- + +/*!50001 DROP TABLE IF EXISTS `role`*/; +/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `role` AS select `account`.`role`.`id` AS `id`,`account`.`role`.`name` AS `name`,`account`.`role`.`description` AS `description`,`account`.`role`.`hasLogin` AS `hasLogin` from `account`.`role` */; +/*!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 `route` +-- + +/*!50001 DROP TABLE IF EXISTS `route`*/; +/*!50001 DROP VIEW IF EXISTS `route`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `route` AS select `a`.`Id_Ruta` AS `id`,`a`.`Id_Trabajador` AS `workerFk`,`a`.`Fecha` AS `created`,`a`.`Id_Vehiculo` AS `vehicleFk`,`a`.`Id_Agencia` AS `agencyModeFk`,`a`.`Hora` AS `time`,`a`.`ok` AS `isOk`,`a`.`km_start` AS `kmStart`,`a`.`km_end` AS `kmEnd`,`a`.`date_start` AS `started`,`a`.`date_end` AS `finished`,`a`.`gestdoc_id` AS `gestdocFk`,`a`.`cost` AS `cost`,`a`.`m3` AS `m3`,`a`.`description` AS `description` from `vn2008`.`Rutas` `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 `routesControl` +-- + +/*!50001 DROP TABLE IF EXISTS `routesControl`*/; +/*!50001 DROP VIEW IF EXISTS `routesControl`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `routesControl` AS select `t`.`Id_Ruta` AS `routeFk`,count(`e`.`expeditions_id`) AS `expeditions`,count(`sl`.`scan_line_id`) AS `scanned`,count(distinct `sl`.`scan_id`) AS `pallets`,max(`sl`.`odbc_date`) AS `lastScanned` from ((`vn2008`.`Tickets` `t` join `vn2008`.`expeditions` `e` on((`t`.`Id_Ticket` = `e`.`ticket_id`))) left join `vn2008`.`scan_line` `sl` on((`e`.`expeditions_id` = `sl`.`code`))) where (`t`.`Fecha` >= (curdate() + interval -(1) day)) group by `t`.`Id_Ruta` */; +/*!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 `sale` +-- + +/*!50001 DROP TABLE IF EXISTS `sale`*/; +/*!50001 DROP VIEW IF EXISTS `sale`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `sale` AS select `m`.`Id_Movimiento` AS `id`,`m`.`Id_Article` AS `itemFk`,`m`.`Id_Ticket` AS `ticketFk`,`m`.`Concepte` AS `concept`,`m`.`Cantidad` AS `quantity`,`m`.`Preu` AS `price`,`m`.`Descuento` AS `discount`,`m`.`Reservado` AS `reserved`,`m`.`OK` AS `isPicked`,`m`.`odbc_date` AS `created` from `vn2008`.`Movimientos` `m` */; +/*!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 `saleComponent` +-- + +/*!50001 DROP TABLE IF EXISTS `saleComponent`*/; +/*!50001 DROP VIEW IF EXISTS `saleComponent`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleComponent` AS select `mc`.`Id_Movimiento` AS `saleFk`,`mc`.`Id_Componente` AS `componentFk`,`mc`.`Valor` AS `value` from `vn2008`.`Movimientos_componentes` `mc` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `state` +-- + +/*!50001 DROP TABLE IF EXISTS `state`*/; +/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `state` AS select `s`.`id` AS `id`,`s`.`name` AS `name`,`s`.`order` AS `order`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code` from `vn2008`.`state` `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 `supplier` +-- + +/*!50001 DROP TABLE IF EXISTS `supplier`*/; +/*!50001 DROP VIEW IF EXISTS `supplier`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `supplier` AS select `p`.`Id_Proveedor` AS `id`,`p`.`Proveedor` AS `name`,`p`.`cuenta` AS `account`,`p`.`pais_id` AS `countryFk`,`p`.`NIF` AS `nif`,`p`.`Agricola` AS `isFarmer`,`p`.`cuentaret` AS `retAccount`,`p`.`ComisionProveedor` AS `commission`,`p`.`odbc_time` AS `created`,`p`.`postcode_id` AS `postcodeFk`,`p`.`active` AS `isActive`,`p`.`Domicilio` AS `street`,`p`.`Localidad` AS `city`,`p`.`province_id` AS `provinceFk`,`p`.`codpos` AS `postCode` from `vn2008`.`Proveedores` `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 `supplierAccount` +-- + +/*!50001 DROP TABLE IF EXISTS `supplierAccount`*/; +/*!50001 DROP VIEW IF EXISTS `supplierAccount`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `supplierAccount` AS select `pa`.`Id_Proveedores_account` AS `id`,`pa`.`Id_Proveedor` AS `supplierFk`,`pa`.`IBAN` AS `iban`,`pa`.`entity_id` AS `bankEntityFk` from `vn2008`.`Proveedores_account` `pa` */; +/*!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 `tagL10n` +-- + +/*!50001 DROP TABLE IF EXISTS `tagL10n`*/; +/*!50001 DROP VIEW IF EXISTS `tagL10n`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `tagL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`tag` `t` left join `tagI18n` `i` on(((`i`.`tagFk` = `t`.`id`) and (`i`.`lang` = `util`.`LANG`())))) */; +/*!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 `taxClass` +-- + +/*!50001 DROP TABLE IF EXISTS `taxClass`*/; +/*!50001 DROP VIEW IF EXISTS `taxClass`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `taxClass` AS select `c`.`iva_group_id` AS `id`,`c`.`description` AS `description`,`c`.`code` AS `code` from `vn2008`.`iva_group` `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 `taxClassCode` +-- + +/*!50001 DROP TABLE IF EXISTS `taxClassCode`*/; +/*!50001 DROP VIEW IF EXISTS `taxClassCode`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `taxClassCode` AS select `c`.`iva_group_id` AS `taxClassFk`,`c`.`date` AS `effectived`,`c`.`iva_codigo_id` AS `taxCodeFk` from `vn2008`.`iva_group_codigo` `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 `taxCode` +-- + +/*!50001 DROP TABLE IF EXISTS `taxCode`*/; +/*!50001 DROP VIEW IF EXISTS `taxCode`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `taxCode` AS select `ic`.`id` AS `id`,`ic`.`fecha` AS `dated`,`ic`.`codigo` AS `code`,`ic`.`iva_tipo_id` AS `taxTypeFk`,`ic`.`iva` AS `rate`,`ic`.`recargo` AS `equalizationTax`,`ic`.`tipo` AS `type`,`ic`.`link` AS `link`,`ic`.`isActive` AS `isActive`,`ic`.`updated` AS `updated`,`ic`.`transactionCode` AS `transactionCode` from `vn2008`.`iva_codigo` `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 `taxType` +-- + +/*!50001 DROP TABLE IF EXISTS `taxType`*/; +/*!50001 DROP VIEW IF EXISTS `taxType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `taxType` AS select `t`.`id` AS `id`,`t`.`alias` AS `nickname`,`t`.`isAccrued` AS `isAccrued`,`t`.`serie_id` AS `serial`,`t`.`TIPOOPE` AS `TIPOOPE`,`t`.`descripcion` AS `description`,`t`.`Id_Pais` AS `countryFk` from `vn2008`.`iva_tipo` `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 `ticket` +-- + +/*!50001 DROP TABLE IF EXISTS `ticket`*/; +/*!50001 DROP VIEW IF EXISTS `ticket`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticket` AS select `t`.`Id_Ticket` AS `id`,`t`.`Id_Cliente` AS `clientFk`,`t`.`warehouse_id` AS `warehouseFk`,`t`.`Fecha` AS `shipped`,`t`.`landing` AS `landed`,`t`.`Alias` AS `nickname`,`t`.`Factura` AS `refFk`,`t`.`Id_Consigna` AS `addressFk`,`t`.`Localizacion` AS `location`,`t`.`Solucion` AS `solution`,`t`.`Id_Ruta` AS `routeFk`,`t`.`empresa_id` AS `companyFk`,`t`.`Id_Agencia` AS `agencyModeFk`,`t`.`Prioridad` AS `priority`,`t`.`Bultos` AS `packages`,`t`.`odbc_date` AS `created` from `vn2008`.`Tickets` `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 `ticketObservation` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketObservation`*/; +/*!50001 DROP VIEW IF EXISTS `ticketObservation`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketObservation` AS select `to`.`ticket_observation_id` AS `id`,`to`.`Id_Ticket` AS `ticketFk`,`to`.`observation_type_id` AS `observationTypeFk`,`to`.`text` AS `description` from `vn2008`.`ticket_observation` `to` */; +/*!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 `ticketState` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketState`*/; +/*!50001 DROP VIEW IF EXISTS `ticketState`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`ts`.`Id_Ticket` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code`,`ts`.`Id_Ticket` AS `ticket`,`i`.`Id_Trabajador` AS `worker` from ((`vn2008`.`Tickets_state` `ts` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `ts`.`inter_id`))) join `vn2008`.`state` `s` on((`s`.`id` = `i`.`state_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 `ticketStateToday` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketStateToday`*/; +/*!50001 DROP VIEW IF EXISTS `ticketStateToday`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketStateToday` AS select `ts`.`ticket` AS `ticket`,`ts`.`state` AS `state`,`ts`.`productionOrder` AS `productionOrder`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`worker` AS `worker`,`ts`.`code` AS `code` from (`vn`.`ticketState` `ts` join `vn`.`ticket` `t` on((`t`.`id` = `ts`.`ticket`))) where (`t`.`shipped` between curdate() and `MIDNIGHT`(curdate())) */; +/*!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 `ticketTracking` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketTracking`*/; +/*!50001 DROP VIEW IF EXISTS `ticketTracking`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketTracking` AS select `i`.`inter_id` AS `id`,`i`.`state_id` AS `stateFk`,`i`.`odbc_date` AS `created`,`i`.`Id_Ticket` AS `ticketFk`,`i`.`Id_Trabajador` AS `workerFk` from `vncontrol`.`inter` `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 `time` +-- + +/*!50001 DROP TABLE IF EXISTS `time`*/; +/*!50001 DROP VIEW IF EXISTS `time`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `time` AS select `t`.`date` AS `dated`,`t`.`period` AS `period`,`t`.`month` AS `month`,`t`.`year` AS `year`,`t`.`day` AS `day`,`t`.`week` AS `week` from `vn2008`.`time` `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 `travel` +-- + +/*!50001 DROP TABLE IF EXISTS `travel`*/; +/*!50001 DROP VIEW IF EXISTS `travel`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `travel` AS select `t`.`id` AS `id`,`t`.`shipment` AS `shipped`,`t`.`shipment_hour` AS `shipmentHour`,`t`.`landing` AS `landed`,`t`.`landing_hour` AS `landingHour`,`t`.`warehouse_id` AS `warehouseInFk`,`t`.`warehouse_id_out` AS `warehouseOutFk`,`t`.`agency_id` AS `agencyFk`,`t`.`ref` AS `ref`,`t`.`delivered` AS `isDelivered`,`t`.`received` AS `isReceived`,`t`.`m3` AS `m3` from `vn2008`.`travel` `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 `unary` +-- + +/*!50001 DROP TABLE IF EXISTS `unary`*/; +/*!50001 DROP VIEW IF EXISTS `unary`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `unary` AS select `a`.`id` AS `id`,`a`.`parent` AS `parent` from `vn2008`.`unary` `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 `unaryScan` +-- + +/*!50001 DROP TABLE IF EXISTS `unaryScan`*/; +/*!50001 DROP VIEW IF EXISTS `unaryScan`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `unaryScan` AS select `u`.`unary_id` AS `unaryFk`,`u`.`name` AS `name`,`u`.`odbc_date` AS `created`,`u`.`type` AS `type` from `vn2008`.`unary_scan` `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 `unaryScanLine` +-- + +/*!50001 DROP TABLE IF EXISTS `unaryScanLine`*/; +/*!50001 DROP VIEW IF EXISTS `unaryScanLine`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `unaryScanLine` AS select `u`.`id` AS `id`,`u`.`code` AS `code`,`u`.`odbc_date` AS `created`,`u`.`unary_id` AS `unaryScanFk` from `vn2008`.`unary_scan_line` `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 `unaryScanLineBuy` +-- + +/*!50001 DROP TABLE IF EXISTS `unaryScanLineBuy`*/; +/*!50001 DROP VIEW IF EXISTS `unaryScanLineBuy`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `unaryScanLineBuy` AS select `u`.`scan_line_id` AS `unaryScanLineFk`,`u`.`Id_Article` AS `itemFk` from `vn2008`.`unary_scan_line_buy` `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 `unaryScanLineExpedition` +-- + +/*!50001 DROP TABLE IF EXISTS `unaryScanLineExpedition`*/; +/*!50001 DROP VIEW IF EXISTS `unaryScanLineExpedition`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `unaryScanLineExpedition` AS select `u`.`scan_line_id` AS `unaryScanLineFk`,`u`.`expedition_id` AS `expeditionFk` from `vn2008`.`unary_scan_line_expedition` `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 `user` +-- + +/*!50001 DROP TABLE IF EXISTS `user`*/; +/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `user` AS select `account`.`user`.`id` AS `id`,`account`.`user`.`name` AS `name`,`account`.`user`.`password` AS `password`,`account`.`user`.`role` AS `role`,`account`.`user`.`active` AS `active`,`account`.`user`.`recoverPass` AS `recoverPass`,`account`.`user`.`lastPassChange` AS `lastPassChange` from `account`.`user` */; +/*!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 `vehicle` +-- + +/*!50001 DROP TABLE IF EXISTS `vehicle`*/; +/*!50001 DROP VIEW IF EXISTS `vehicle`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `vehicle` AS select `v`.`Id_Vehiculo` AS `id`,`v`.`Matricula` AS `numberPlate`,`v`.`Marca` AS `tradeMark`,`v`.`Modelo` AS `model`,`v`.`empresa_id` AS `companyFk`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`active` AS `isActive` from `vn2008`.`Vehiculos` `v` */; +/*!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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `warehouse` AS select `t`.`id` AS `id`,`t`.`name` AS `name`,`t`.`inventario` AS `isInventory`,`t`.`is_comparative` AS `isComparative`,`t`.`comisionantes` AS `hasComission`,`t`.`isManaged` AS `isManaged` from `vn2008`.`warehouse` `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 `warehouseAlias` +-- + +/*!50001 DROP TABLE IF EXISTS `warehouseAlias`*/; +/*!50001 DROP VIEW IF EXISTS `warehouseAlias`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `warehouseAlias` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `worker` +-- + +/*!50001 DROP TABLE IF EXISTS `worker`*/; +/*!50001 DROP VIEW IF EXISTS `worker`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `worker` AS select `t`.`Id_Trabajador` AS `id`,`t`.`CodigoTrabajador` AS `workerCode`,`t`.`Nombre` AS `firstName`,`t`.`Apellidos` AS `name`,`t`.`user_id` AS `userFk`,`t`.`phone` AS `phone`,`t`.`boss` AS `bossFk` from `vn2008`.`Trabajadores` `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 `workerTeam` +-- + +/*!50001 DROP TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTeam` AS select `w`.`team` AS `team`,`w`.`user` AS `user`,`w`.`id` AS `id`,`t`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`workerTeam` `w` left join `vn2008`.`Trabajadores` `t` on((`t`.`user_id` = `w`.`user`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Current Database: `edi` +-- + +USE `edi`; + +-- +-- Current Database: `bs` +-- + +USE `bs`; + +-- +-- Final view structure for view `VentasPorCliente` +-- + +/*!50001 DROP TABLE IF EXISTS `VentasPorCliente`*/; +/*!50001 DROP VIEW IF EXISTS `VentasPorCliente`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `VentasPorCliente` AS select `v`.`Id_Cliente` AS `Id_Cliente`,round(sum(`v`.`importe`),0) AS `VentaBasica`,`t`.`year` AS `year`,`t`.`month` AS `month` from (`vn2008`.`time` `t` join `bs`.`ventas` `v` on((`v`.`fecha` = `t`.`date`))) group by `v`.`Id_Cliente`,`t`.`year`,`t`.`month` */; +/*!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_ventas` +-- + +/*!50001 DROP TABLE IF EXISTS `v_ventas`*/; +/*!50001 DROP VIEW IF EXISTS `v_ventas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_ventas` AS select (`bs`.`ventas`.`importe` * `vn2008`.`Movimientos`.`Cantidad`) AS `importe`,`bs`.`ventas`.`recargo` AS `recargo`,`vn2008`.`time`.`year` AS `year`,`vn2008`.`time`.`month` AS `month`,`vn2008`.`time`.`week` AS `week`,`vn2008`.`time`.`day` AS `day` from ((`bs`.`ventas` join `vn2008`.`time` on((`vn2008`.`time`.`date` = `bs`.`ventas`.`fecha`))) join `vn2008`.`Movimientos` on((`bs`.`ventas`.`Id_Movimiento` = `vn2008`.`Movimientos`.`Id_Movimiento`))) group by `vn2008`.`time`.`date` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Current Database: `bi` +-- + +USE `bi`; + +-- +-- Final view structure for view `analisis_grafico_ventas` +-- + +/*!50001 DROP TABLE IF EXISTS `analisis_grafico_ventas`*/; +/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `analisis_grafico_ventas` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */; +/*!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 `analisis_ventas_simple` +-- + +/*!50001 DROP TABLE IF EXISTS `analisis_ventas_simple`*/; +/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `analisis_ventas_simple` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */; +/*!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 `customerRiskOverdue` +-- + +/*!50001 DROP TABLE IF EXISTS `customerRiskOverdue`*/; +/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `customerRiskOverdue` AS select `cr`.`customer_id` AS `customer_id`,`cr`.`amount` AS `amount`,`cr`.`company_id` AS `company_id` from (((`bi`.`customer_risk` `cr` join `vn2008`.`empresa` `e` on((`e`.`id` = `cr`.`company_id`))) join `vn2008`.`Clientes` `c` on((`cr`.`customer_id` = `c`.`id_cliente`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where (`cr`.`amount` and `e`.`morosidad` and `pm`.`deudaviva`) union all select `f`.`Id_Cliente` AS `Id_Cliente`,-(round(`f`.`Importe`,2)) AS `importe`,`f`.`empresa_id` AS `empresa_id` from (((`vn2008`.`Facturas` `f` join `vn2008`.`Clientes` `c` on((`f`.`Id_Cliente` = `c`.`id_cliente`))) join `vn2008`.`empresa` `e` on((`e`.`id` = `f`.`empresa_id`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where ((`f`.`Fecha` > (curdate() + interval -(101) day)) and ((`vn2008`.`paymentday`(`f`.`Fecha`,`c`.`vencimiento`) + interval `pm`.`graceDays` day) > curdate()) and (`f`.`Importe` > 0) and `e`.`morosidad` and `pm`.`deudaviva`) */; +/*!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 `last_Id_Cubo` +-- + +/*!50001 DROP TABLE IF EXISTS `last_Id_Cubo`*/; +/*!50001 DROP VIEW IF EXISTS `last_Id_Cubo`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `last_Id_Cubo` AS select `C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Article` AS `Id_Article`,`tr`.`warehouse_id` AS `warehouse_id`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Packing` AS `Packing` from ((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on((`C`.`Id_Entrada` = `E`.`Id_Entrada`))) join `vn2008`.`travel` `tr` on((`E`.`travel_id` = `tr`.`id`))) where ((`C`.`Id_Cubo` is not null) and (`C`.`Id_Cubo` <> '--') and (`tr`.`landing` > (curdate() - interval 18 month))) order by `C`.`Id_Compra` 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 `v_clientes_jerarquia` +-- + +/*!50001 DROP TABLE IF EXISTS `v_clientes_jerarquia`*/; +/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_clientes_jerarquia` AS select `c`.`id_cliente` AS `Id_Cliente`,`c`.`cliente` AS `Cliente`,`t`.`CodigoTrabajador` AS `Comercial`,`tj`.`CodigoTrabajador` AS `Jefe` from (((`vn2008`.`Clientes` `c` join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `c`.`Id_Trabajador`))) join `vn2008`.`jerarquia` on((`vn2008`.`jerarquia`.`worker_id` = `c`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `tj` on((`tj`.`Id_Trabajador` = `vn2008`.`jerarquia`.`boss_id`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `v_ventas_contables` +-- + +/*!50001 DROP TABLE IF EXISTS `v_ventas_contables`*/; +/*!50001 DROP VIEW IF EXISTS `v_ventas_contables`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_ventas_contables` AS select `vn2008`.`time`.`year` AS `year`,`vn2008`.`time`.`month` AS `month`,cast(sum((((`m`.`Cantidad` * `m`.`Preu`) * (100 - `m`.`Descuento`)) / 100)) as decimal(10,0)) AS `importe` from (((`vn2008`.`Tickets` `t` join `bi`.`f_tvc` on((`t`.`Id_Ticket` = `bi`.`f_tvc`.`Id_Ticket`))) join `vn2008`.`Movimientos` `m` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) join `vn2008`.`time` on((`vn2008`.`time`.`date` = cast(`t`.`Fecha` as date)))) where (`t`.`Fecha` >= '2014-01-01') group by `vn2008`.`time`.`year`,`vn2008`.`time`.`month` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; -- -- Current Database: `pbx` @@ -68496,6 +73335,7 @@ USE `pbx`; -- Final view structure for view `cdrConf` -- +/*!50001 DROP TABLE IF EXISTS `cdrConf`*/; /*!50001 DROP VIEW IF EXISTS `cdrConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68514,6 +73354,7 @@ USE `pbx`; -- Final view structure for view `followmeConf` -- +/*!50001 DROP TABLE IF EXISTS `followmeConf`*/; /*!50001 DROP VIEW IF EXISTS `followmeConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68532,6 +73373,7 @@ USE `pbx`; -- Final view structure for view `followmeNumberConf` -- +/*!50001 DROP TABLE IF EXISTS `followmeNumberConf`*/; /*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68550,6 +73392,7 @@ USE `pbx`; -- Final view structure for view `queueConf` -- +/*!50001 DROP TABLE IF EXISTS `queueConf`*/; /*!50001 DROP VIEW IF EXISTS `queueConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68568,6 +73411,7 @@ USE `pbx`; -- Final view structure for view `queueMemberConf` -- +/*!50001 DROP TABLE IF EXISTS `queueMemberConf`*/; /*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68586,6 +73430,7 @@ USE `pbx`; -- Final view structure for view `sipConf` -- +/*!50001 DROP TABLE IF EXISTS `sipConf`*/; /*!50001 DROP VIEW IF EXISTS `sipConf`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68600,6 +73445,594 @@ USE `pbx`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Current Database: `cache` +-- + +USE `cache`; + +-- +-- Current Database: `salix` +-- + +USE `salix`; + +-- +-- Final view structure for view `Account` +-- + +/*!50001 DROP TABLE IF EXISTS `Account`*/; +/*!50001 DROP VIEW IF EXISTS `Account`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Account` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`password` AS `password`,`u`.`role` AS `roleFk`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`created` AS `created`,`u`.`updated` AS `updated` 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 `Accounting` +-- + +/*!50001 DROP TABLE IF EXISTS `Accounting`*/; +/*!50001 DROP VIEW IF EXISTS `Accounting`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Accounting` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `Address` +-- + +/*!50001 DROP TABLE IF EXISTS `Address`*/; +/*!50001 DROP VIEW IF EXISTS `Address`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Address` AS select `a`.`id_consigna` AS `id`,`a`.`consignatario` AS `consignee`,`a`.`domicilio` AS `street`,`a`.`poblacion` AS `city`,`a`.`codPostal` AS `postcode`,`a`.`province_id` AS `provinceFk`,`a`.`telefono` AS `phone`,`a`.`movil` AS `mobile`,`a`.`active` AS `isEnabled`,`a`.`predeterminada` AS `isDefaultAddress`,`a`.`Id_cliente` AS `clientFk`,`a`.`Id_Agencia` AS `defaultAgencyFk`,`a`.`longitude` AS `longitude`,`a`.`latitude` AS `latitude`,`a`.`isEqualizated` AS `isEqualizated` from `vn2008`.`Consignatarios` `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 `Agency` +-- + +/*!50001 DROP TABLE IF EXISTS `Agency`*/; +/*!50001 DROP VIEW IF EXISTS `Agency`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Agency` AS select `a`.`agency_id` AS `id`,`a`.`name` AS `name`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`por_volumen` AS `isVolumetric`,`a`.`Id_Banco` AS `bankFk`,`a`.`warehouse_alias_id` AS `warehouseAliasFk` from `vn2008`.`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 `AgencyMode` +-- + +/*!50001 DROP TABLE IF EXISTS `AgencyMode`*/; +/*!50001 DROP VIEW IF EXISTS `AgencyMode`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `AgencyMode` AS select `a`.`Id_Agencia` AS `id`,`a`.`Agencia` AS `name`,`a`.`description` AS `description`,`a`.`Vista` AS `agencyTypeFk`,`a`.`m3` AS `m3`,`a`.`agency_id` AS `agencyFk`,`a`.`inflacion` AS `inflation`,`a`.`send_mail` AS `sendMailTo`,`a`.`tpv` AS `isForTicket` from `vn2008`.`Agencias` `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 `Bank` +-- + +/*!50001 DROP TABLE IF EXISTS `Bank`*/; +/*!50001 DROP VIEW IF EXISTS `Bank`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Bank` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `cash`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `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 `City` +-- + +/*!50001 DROP TABLE IF EXISTS `City`*/; +/*!50001 DROP VIEW IF EXISTS `City`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `City` AS select `c`.`city_id` AS `id`,`c`.`name` AS `name`,`c`.`province_id` AS `provinceFk` from `vn2008`.`city` `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 `Client` +-- + +/*!50001 DROP TABLE IF EXISTS `Client`*/; +/*!50001 DROP VIEW IF EXISTS `Client`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`province_id` AS `provinceFk`,`c`.`Id_Pais` AS `countryFk`,`c`.`e-mail` AS `email`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`activo` AS `active`,`c`.`descuento` AS `discount`,`c`.`credito` AS `credit`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`RE` AS `equalizationTax`,`c`.`invoice` AS `hasToInvoice`,`c`.`mail` AS `invoiceByEmail`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `sepaVnl`,`c`.`coreVnl` AS `coreVnl`,`c`.`coreVnh` AS `coreVnh`,`c`.`EYPBC` AS `eypbc`,`c`.`calidad` AS `quality`,`c`.`vies` AS `vies`,`c`.`real` AS `isRelevant`,`c`.`clientes_tipo_id` AS `typeFk`,`c`.`Cuenta` AS `accountingAccount`,`c`.`created` AS `created`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress` from `vn2008`.`Clientes` `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 `ClientCredit` +-- + +/*!50001 DROP TABLE IF EXISTS `ClientCredit`*/; +/*!50001 DROP VIEW IF EXISTS `ClientCredit`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ClientCredit` AS select `c`.`id` AS `id`,`c`.`Id_Cliente` AS `clientFk`,`c`.`Id_Trabajador` AS `employeeFk`,`c`.`amount` AS `amount`,`c`.`odbc_date` AS `created` from `vn2008`.`credit` `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 `ClientCreditLimit` +-- + +/*!50001 DROP TABLE IF EXISTS `ClientCreditLimit`*/; +/*!50001 DROP VIEW IF EXISTS `ClientCreditLimit`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ClientCreditLimit` AS select `l`.`id` AS `id`,`l`.`maxAmount` AS `maxAmount`,`l`.`roleFk` AS `roleFk` from `vn`.`clientCreditLimit` `l` */; +/*!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 `ClientObservation` +-- + +/*!50001 DROP TABLE IF EXISTS `ClientObservation`*/; +/*!50001 DROP VIEW IF EXISTS `ClientObservation`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ClientObservation` AS select `o`.`client_observation_id` AS `id`,`o`.`Id_Cliente` AS `clientFk`,`o`.`Id_Trabajador` AS `employeeFk`,`o`.`text` AS `text`,`o`.`odbc_date` AS `created` from `vn2008`.`client_observation` `o` */; +/*!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 `ClientType` +-- + +/*!50001 DROP TABLE IF EXISTS `ClientType`*/; +/*!50001 DROP VIEW IF EXISTS `ClientType`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ClientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type` from `vn2008`.`clientes_tipo` `ct` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ContactChannel` +-- + +/*!50001 DROP TABLE IF EXISTS `ContactChannel`*/; +/*!50001 DROP VIEW IF EXISTS `ContactChannel`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `ContactChannel` AS select `c`.`chanel_id` AS `id`,`c`.`name` AS `name` from `vn2008`.`chanel` `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 `Country` +-- + +/*!50001 DROP TABLE IF EXISTS `Country`*/; +/*!50001 DROP VIEW IF EXISTS `Country`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Country` AS select `c`.`Id` AS `id`,`c`.`Pais` AS `name`,`c`.`CEE` AS `inCee`,`c`.`Codigo` AS `code`,`c`.`Id_Moneda` AS `currencyFk`,`c`.`Id_Paisreal` AS `realCountryFk` from `vn2008`.`Paises` `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 `CreditClassification` +-- + +/*!50001 DROP TABLE IF EXISTS `CreditClassification`*/; +/*!50001 DROP VIEW IF EXISTS `CreditClassification`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `CreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `clientFk`,`vn`.`creditClassification`.`dateStart` AS `started`,`vn`.`creditClassification`.`dateEnd` AS `ended` from `vn`.`creditClassification` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `Delivery` +-- + +/*!50001 DROP TABLE IF EXISTS `Delivery`*/; +/*!50001 DROP VIEW IF EXISTS `Delivery`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Delivery` AS select `r`.`Id_Ruta` AS `id`,`r`.`Fecha` AS `date`,`r`.`m3` AS `m3`,`t`.`warehouse_id` AS `warehouseFk` from (`vn2008`.`Rutas` `r` join `vn2008`.`Tickets` `t` on((`r`.`Id_Ruta` = `t`.`Id_Ruta`))) where (`r`.`Fecha` = curdate()) group by `r`.`Id_Ruta` */; +/*!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 `Employee` +-- + +/*!50001 DROP TABLE IF EXISTS `Employee`*/; +/*!50001 DROP VIEW IF EXISTS `Employee`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Employee` AS select `e`.`Id_Trabajador` AS `id`,`e`.`Nombre` AS `name`,`e`.`Apellidos` AS `surname`,`e`.`user_id` AS `userFk` from `vn2008`.`Trabajadores` `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 `PayMethod` +-- + +/*!50001 DROP TABLE IF EXISTS `PayMethod`*/; +/*!50001 DROP VIEW IF EXISTS `PayMethod`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `PayMethod` AS select `m`.`id` AS `id`,`m`.`name` AS `name`,`m`.`graceDays` AS `graceDays`,`m`.`deudaviva` AS `outstandingDebt`,`m`.`ibanRequired` AS `ibanRequired` from `vn2008`.`pay_met` `m` */; +/*!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 `Province` +-- + +/*!50001 DROP TABLE IF EXISTS `Province`*/; +/*!50001 DROP VIEW IF EXISTS `Province`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Province` AS select `p`.`province_id` AS `id`,`p`.`name` AS `name`,`p`.`Paises_Id` AS `countryFk`,`p`.`warehouse_id` AS `warehouseFk`,`p`.`zone` AS `zoneFk` from `vn2008`.`province` `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` +-- + +/*!50001 DROP TABLE IF EXISTS `Role`*/; +/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Role` AS select `r`.`id` AS `id`,`r`.`name` AS `name`,`r`.`description` AS `description`,`r`.`created` AS `created`,`r`.`modified` AS `modified` from `account`.`role` `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 `RoleMapping` +-- + +/*!50001 DROP TABLE IF EXISTS `RoleMapping`*/; +/*!50001 DROP VIEW IF EXISTS `RoleMapping`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `RoleMapping` AS select ((`u`.`id` * 1000) + `r`.`inheritsFrom`) AS `id`,'USER' AS `principalType`,`u`.`id` AS `principalId`,`r`.`inheritsFrom` AS `roleId` from (`account`.`user` `u` join `account`.`roleRole` `r` on((`r`.`role` = `u`.`role`))) */; +/*!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 `Route` +-- + +/*!50001 DROP TABLE IF EXISTS `Route`*/; +/*!50001 DROP VIEW IF EXISTS `Route`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Route` AS select `r`.`Id_Ruta` AS `id`,`r`.`Fecha` AS `date` from `vn2008`.`Rutas` `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 `State` +-- + +/*!50001 DROP TABLE IF EXISTS `State`*/; +/*!50001 DROP VIEW IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `State` AS select `s`.`id` AS `id`,`s`.`name` AS `name`,`s`.`order` AS `order`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code` from `vn2008`.`state` `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 `Ticket` +-- + +/*!50001 DROP TABLE IF EXISTS `Ticket`*/; +/*!50001 DROP VIEW IF EXISTS `Ticket`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Ticket` AS select `t`.`Id_Ticket` AS `id`,`t`.`Id_Agencia` AS `agencyFk`,`t`.`Id_Trabajador` AS `employeeFk`,`t`.`Fecha` AS `date`,`t`.`Hora` AS `hour`,`t`.`Id_Cliente` AS `clientFk` from `vn2008`.`Tickets` `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 `TicketState` +-- + +/*!50001 DROP TABLE IF EXISTS `TicketState`*/; +/*!50001 DROP VIEW IF EXISTS `TicketState`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `TicketState` AS select `i`.`inter_id` AS `id`,`i`.`Id_Ticket` AS `ticketFk`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `employeeFk`,`i`.`odbc_date` AS `updated` from `vncontrol`.`inter` `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 `Vehicle` +-- + +/*!50001 DROP TABLE IF EXISTS `Vehicle`*/; +/*!50001 DROP VIEW IF EXISTS `Vehicle`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Vehicle` AS select `v`.`Id_Vehiculo` AS `id`,`v`.`Matricula` AS `numberPlate`,`v`.`Marca` AS `tradeMark`,`v`.`Modelo` AS `model`,`v`.`empresa_id` AS `companyFk`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`active` AS `isActive` from `vn2008`.`Vehiculos` `v` */; +/*!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 TABLE IF EXISTS `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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Warehouse` AS select `w`.`id` AS `id`,`w`.`name` AS `name`,`w`.`tpv` AS `tpv`,`w`.`inventario` AS `inventory`,`w`.`isManaged` AS `isManaged` from `vn2008`.`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 `WarehouseAlias` +-- + +/*!50001 DROP TABLE IF EXISTS `WarehouseAlias`*/; +/*!50001 DROP VIEW IF EXISTS `WarehouseAlias`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `WarehouseAlias` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `Worker` +-- + +/*!50001 DROP TABLE IF EXISTS `Worker`*/; +/*!50001 DROP VIEW IF EXISTS `Worker`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Worker` AS select `e`.`Id_Trabajador` AS `id`,`e`.`Nombre` AS `name`,`e`.`Apellidos` AS `surname`,`e`.`user_id` AS `userFk` from `vn2008`.`Trabajadores` `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 `Zone` +-- + +/*!50001 DROP TABLE IF EXISTS `Zone`*/; +/*!50001 DROP VIEW IF EXISTS `Zone`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Zone` AS select `z`.`zone_id` AS `id`,`z`.`name` AS `name`,`z`.`printingOrder` AS `printingOrder` from `vn2008`.`zones` `z` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Current Database: `vncontrol` +-- + +USE `vncontrol`; + -- -- Current Database: `hedera` -- @@ -68610,6 +74043,7 @@ USE `hedera`; -- Final view structure for view `address_view` -- +/*!50001 DROP TABLE IF EXISTS `address_view`*/; /*!50001 DROP VIEW IF EXISTS `address_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68629,6 +74063,7 @@ USE `hedera`; -- Final view structure for view `basket` -- +/*!50001 DROP TABLE IF EXISTS `basket`*/; /*!50001 DROP VIEW IF EXISTS `basket`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68648,6 +74083,7 @@ USE `hedera`; -- Final view structure for view `basket_defaults` -- +/*!50001 DROP TABLE IF EXISTS `basket_defaults`*/; /*!50001 DROP VIEW IF EXISTS `basket_defaults`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68666,6 +74102,7 @@ USE `hedera`; -- Final view structure for view `basket_item` -- +/*!50001 DROP TABLE IF EXISTS `basket_item`*/; /*!50001 DROP VIEW IF EXISTS `basket_item`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68675,26 +74112,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `basket_item` AS select `r`.`id` AS `id`,`r`.`order_id` AS `order_id`,`r`.`warehouse_id` AS `warehouse_id`,`r`.`item_id` AS `item_id`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`order_row` `r` where (`r`.`order_id` = `basketGetId`()) */ -/*!50002 WITH CASCADED CHECK OPTION */; -/*!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 `customer_user` --- - -/*!50001 DROP VIEW IF EXISTS `customer_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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `customer_user` AS select `c`.`id_cliente` AS `user_id`,`c`.`cliente` AS `name` from `vn2008`.`Clientes` `c` where (`c`.`id_cliente` = `account`.`userGetId`()) */ +/*!50001 VIEW `basket_item` AS select `r`.`id` AS `id`,`r`.`orderFk` AS `order_id`,`r`.`warehouseFk` AS `warehouse_id`,`r`.`itemFk` AS `item_id`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`orderRow` `r` where (`r`.`orderFk` = `BASKETGETID`()) */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -68704,6 +74122,7 @@ USE `hedera`; -- Final view structure for view `customer_view` -- +/*!50001 DROP TABLE IF EXISTS `customer_view`*/; /*!50001 DROP VIEW IF EXISTS `customer_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68723,6 +74142,7 @@ USE `hedera`; -- Final view structure for view `invoice_view` -- +/*!50001 DROP TABLE IF EXISTS `invoice_view`*/; /*!50001 DROP VIEW IF EXISTS `invoice_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68737,10 +74157,185 @@ USE `hedera`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `myAddress` +-- + +/*!50001 DROP TABLE IF EXISTS `myAddress`*/; +/*!50001 DROP VIEW IF EXISTS `myAddress`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myAddress` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`street` AS `street`,`t`.`city` AS `city`,`t`.`postalCode` AS `postalCode`,`t`.`provinceFk` AS `provinceFk`,`t`.`nickname` AS `nickname`,`t`.`isDefaultAddress` AS `isDefaultAddress`,`t`.`isActive` AS `isActive`,`t`.`longitude` AS `longitude`,`t`.`latitude` AS `latitude`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`agencyFk` AS `agencyFk` from `vn`.`address` `t` where (`t`.`clientFk` = `account`.`userGetId`()) */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!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 `myClient` +-- + +/*!50001 DROP TABLE IF EXISTS `myClient`*/; +/*!50001 DROP VIEW IF EXISTS `myClient`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myClient` AS select `c`.`id` AS `id`,`c`.`isToBeMailed` AS `isToBeMailed`,`c`.`defaultAddressFk` AS `defaultAddressFk`,`c`.`credit` AS `credit` from `vn`.`client` `c` where (`c`.`id` = `account`.`userGetId`()) */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!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 `myInvoice` +-- + +/*!50001 DROP TABLE IF EXISTS `myInvoice`*/; +/*!50001 DROP VIEW IF EXISTS `myInvoice`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myInvoice` AS select `i`.`id` AS `id`,`i`.`ref` AS `ref`,`i`.`issued` AS `issued`,`i`.`amount` AS `amount` from `vn`.`invoiceOut` `i` where ((`i`.`clientFk` = `account`.`userGetId`()) and `i`.`pdf`) */; +/*!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 `myMenu` +-- + +/*!50001 DROP TABLE IF EXISTS `myMenu`*/; +/*!50001 DROP VIEW IF EXISTS `myMenu`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myMenu` AS select `t`.`id` AS `id`,`t`.`path` AS `path`,`t`.`description` AS `description`,`t`.`parentFk` AS `parentFk` from (`hedera`.`menu` `t` join `account`.`userRole` `r` on((`r`.`id` = `t`.`roleFk`))) order by `t`.`parentFk`,`t`.`displayOrder`,`t`.`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 `myTicket` +-- + +/*!50001 DROP TABLE IF EXISTS `myTicket`*/; +/*!50001 DROP VIEW IF EXISTS `myTicket`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myTicket` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,`t`.`nickname` AS `nickname`,`t`.`agencyModeFk` AS `agencyModeFk`,`t`.`refFk` AS `refFk`,`t`.`addressFk` AS `addressFk`,`t`.`location` AS `location`,`t`.`companyFk` AS `companyFk` from `vn`.`ticket` `t` where (`t`.`clientFk` = `account`.`userGetId`()) */; +/*!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 `myTicketRow` +-- + +/*!50001 DROP TABLE IF EXISTS `myTicketRow`*/; +/*!50001 DROP VIEW IF EXISTS `myTicketRow`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myTicketRow` AS select `s`.`id` AS `id`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`discount` AS `discount`,`s`.`reserved` AS `reserved`,`s`.`isPicked` AS `isPicked` from (`vn`.`sale` `s` join `hedera`.`myTicket` `t` on((`s`.`ticketFk` = `t`.`id`))) */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!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 `myTpvTransaction` +-- + +/*!50001 DROP TABLE IF EXISTS `myTpvTransaction`*/; +/*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `myTpvTransaction` AS select `t`.`id` AS `id`,`t`.`merchantFk` AS `merchantFk`,`t`.`clientFk` AS `clientFk`,`t`.`receiptFk` AS `receiptFk`,`t`.`amount` AS `amount`,`t`.`response` AS `response`,`t`.`status` AS `status`,`t`.`created` AS `created` from `hedera`.`tpvTransaction` `t` where (`t`.`clientFk` = `account`.`userGetId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `order_basket` +-- + +/*!50001 DROP TABLE IF EXISTS `order_basket`*/; +/*!50001 DROP VIEW IF EXISTS `order_basket`*/; +/*!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 = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_basket` AS select `t`.`clientFk` AS `customer_id`,`t`.`orderFk` AS `order_id` from `basketOrder` `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 `order_component` +-- + +/*!50001 DROP TABLE IF EXISTS `order_component`*/; +/*!50001 DROP VIEW IF EXISTS `order_component`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_component` AS select `t`.`rowFk` AS `order_row_id`,`t`.`componentFk` AS `component_id`,`t`.`price` AS `price` from `orderRowComponent` `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 `order_confirm_time` -- +/*!50001 DROP TABLE IF EXISTS `order_confirm_time`*/; /*!50001 DROP VIEW IF EXISTS `order_confirm_time`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68755,10 +74350,30 @@ USE `hedera`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `order_row` +-- + +/*!50001 DROP TABLE IF EXISTS `order_row`*/; +/*!50001 DROP VIEW IF EXISTS `order_row`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_row` AS select `t`.`id` AS `id`,`t`.`orderFk` AS `order_id`,`t`.`itemFk` AS `item_id`,`t`.`warehouseFk` AS `warehouse_id`,`t`.`shipment` AS `shipment`,`t`.`amount` AS `amount`,`t`.`price` AS `price`,`t`.`rate` AS `rate`,`t`.`created` AS `created`,`t`.`saleFk` AS `Id_Movimiento` from `orderRow` `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 `order_row_view` -- +/*!50001 DROP TABLE IF EXISTS `order_row_view`*/; /*!50001 DROP VIEW IF EXISTS `order_row_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68778,6 +74393,7 @@ USE `hedera`; -- Final view structure for view `order_view` -- +/*!50001 DROP TABLE IF EXISTS `order_view`*/; /*!50001 DROP VIEW IF EXISTS `order_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -68793,10 +74409,11 @@ USE `hedera`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `ticket_row_view` +-- Final view structure for view `user_android` -- -/*!50001 DROP VIEW IF EXISTS `ticket_row_view`*/; +/*!50001 DROP TABLE IF EXISTS `user_android`*/; +/*!50001 DROP VIEW IF EXISTS `user_android`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -68805,62 +74422,7 @@ USE `hedera`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticket_row_view` AS select `m`.`Id_Movimiento` AS `id`,`m`.`Id_Article` AS `item_id`,`m`.`Id_Ticket` AS `ticket_id`,`m`.`Concepte` AS `concept`,`m`.`Cantidad` AS `amount`,`m`.`Preu` AS `price`,`m`.`PrecioFijado` AS `fixed`,`m`.`Descuento` AS `discount`,`m`.`CostFixat` AS `cost`,`m`.`Reservado` AS `reserved`,`m`.`OK` AS `ok` from (`vn2008`.`Movimientos` `m` join `hedera`.`ticket_view` `t` on((`m`.`Id_Ticket` = `t`.`id`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ticket_view` --- - -/*!50001 DROP VIEW IF EXISTS `ticket_view`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticket_view` AS select `t`.`Id_Ticket` AS `id`,`t`.`Id_Cliente` AS `customer_id`,`t`.`warehouse_id` AS `warehouse_id`,`t`.`Fecha` AS `date`,`t`.`landing` AS `delivery`,`t`.`Alias` AS `alias`,`t`.`Id_Agencia` AS `agency_id`,`t`.`Notas` AS `note`,`t`.`Factura` AS `invoice`,`t`.`Id_Consigna` AS `address_id`,`t`.`Id_Trabajador` AS `employee_id`,`t`.`Observaciones` AS `comments`,`t`.`Firmado` AS `signed`,`t`.`Bultos` AS `packages`,`t`.`Localizacion` AS `location`,`t`.`Hora` AS `hour`,`t`.`blocked` AS `blocked`,`t`.`Solucion` AS `solution`,`t`.`empresa_id` AS `company_id`,`a`.`Agencia` AS `type` from (`vn2008`.`Tickets` `t` join `vn2008`.`Agencias` `a` on((`t`.`Id_Agencia` = `a`.`Id_Agencia`))) where (`t`.`Id_Cliente` = `account`.`userGetId`()) */; -/*!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 `tpv_transaction_view` --- - -/*!50001 DROP VIEW IF EXISTS `tpv_transaction_view`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `tpv_transaction_view` AS select `t`.`id` AS `id`,`t`.`merchant_id` AS `merchant_id`,`t`.`customer_id` AS `customer_id`,`t`.`receipt_id` AS `receipt_id`,`t`.`amount` AS `amount`,`t`.`response` AS `response`,`t`.`status` AS `status`,`t`.`date_time` AS `date_time` from `hedera`.`tpv_transaction` `t` where (`t`.`customer_id` = `account`.`userGetId`()) */; -/*!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 `user_android_view` --- - -/*!50001 DROP VIEW IF EXISTS `user_android_view`*/; -/*!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 = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `user_android_view` AS select `a`.`user_id` AS `user_id`,`a`.`android_id` AS `android_id` from `hedera`.`user_android` `a` where (`a`.`user_id` = `account`.`userGetId`()) */ -/*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 VIEW `user_android` AS select `t`.`androidId` AS `android_id`,`t`.`userFk` AS `user_id` from `androidUser` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -68874,4 +74436,4 @@ USE `hedera`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2017-10-10 13:39:29 +-- Dump completed on 2018-02-01 9:35:46 diff --git a/services/db/01-titemLog.sql b/services/db/01-titemLog.sql new file mode 100644 index 000000000..cab6c3d19 --- /dev/null +++ b/services/db/01-titemLog.sql @@ -0,0 +1,17 @@ +CREATE TABLE vn.itemLog + SELECT * FROM vn.entryLog LIMIT 0; + +ALTER TABLE `vn`.`itemLog` +ADD INDEX `itemLogItemFk_idx` (`originFk` ASC), +ADD INDEX `itemLogUserFk_idx` (`userFk` ASC); +ALTER TABLE `vn`.`itemLog` +ADD CONSTRAINT `itemLogItemFk` + FOREIGN KEY (`originFk`) + REFERENCES `vn2008`.`Articles` (`Id_Article`) + ON DELETE NO ACTION + ON UPDATE CASCADE, +ADD CONSTRAINT `itemLogUserFk` + FOREIGN KEY (`userFk`) + REFERENCES `account`.`user` (`id`) + ON DELETE NO ACTION + ON UPDATE CASCADE; diff --git a/services/db/02-fixtures.sql b/services/db/02-fixtures.sql new file mode 100644 index 000000000..9cf4deeec --- /dev/null +++ b/services/db/02-fixtures.sql @@ -0,0 +1,625 @@ +INSERT INTO `account`.`role`(`id`, `name`, `description`) + VALUES + (1, 'employee', 'Privilegios básicos de un empleado'), + (2, 'customer', 'Privilegios básicos de un cliente'), + (3, 'agency', 'Consultar tablas de predicciones de bultos'), + (5, 'administrative', 'Tareas relacionadas con la contabilidad'), + (6, 'guest', 'Privilegios para usuarios sin cuenta'), + (9, 'developer', 'Desarrolladores del sistema'), + (11, 'account', 'Privilegios relacionados con el login'), + (13, 'teamBoss', 'Jefe de departamento'), + (14, 'manageEmployee', 'Privilegios para gestión de empleados'), + (15, 'logistic', 'Departamento de logística'), + (16, 'logisticBoss', 'Jefe del departamento de logística'), + (17, 'adminBoss', 'Jefe del departamento de administración'), + (18, 'salesPerson', 'Departamento de ventas'), + (19, 'salesBoss', 'Jefe del departamento de ventas'), + (20, 'manager', 'Departamento de gerencia'), + (21, 'salesAssistant', 'Jefe auxiliar de ventas'), + (22, 'teamManager', 'Jefe de departamento con privilegios de auxiliar de venta.'), + (30, 'financialBoss', 'Director finaciero'), + (31, 'freelancer', 'Trabajadores por cuenta ajena'), + (32, 'ett', 'Trabajadores de empresa temporal'), + (33, 'root', 'Rol con todos los privilegios'); + +UPDATE `account`.`role` SET `id` = 0 WHERE `id` = 33; + +INSERT INTO `account`.`roleRole`(`role`, `inheritsFrom`) + VALUES + (0, 0), + (0, 1), + (0, 2), + (0, 3), + (0, 5), + (0, 6), + (0, 9), + (0, 11), + (0, 13), + (0, 14), + (0, 15), + (0, 16), + (0, 17), + (0, 18), + (0, 19), + (0, 20), + (0, 21), + (0, 22), + (0, 30), + (0, 31), + (0, 32), + (1, 1), + (1, 2), + (1, 3), + (1, 6), + (1, 11), + (2, 2), + (2, 6), + (2, 11), + (3, 3), + (3, 6), + (3, 11), + (5, 1), + (5, 2), + (5, 3), + (5, 5), + (5, 6), + (5, 11), + (5, 13), + (5, 14), + (5, 18), + (5, 19), + (5, 21), + (6, 6), + (9, 0), + (9, 1), + (9, 2), + (9, 3), + (9, 5), + (9, 6), + (9, 9), + (9, 11), + (9, 13), + (9, 14), + (9, 15), + (9, 16), + (9, 17), + (9, 18), + (9, 19), + (9, 20), + (9, 21), + (9, 22), + (9, 30), + (9, 31), + (9, 32), + (11, 6), + (11, 11), + (13, 1), + (13, 2), + (13, 3), + (13, 6), + (13, 11), + (13, 13), + (13, 14), + (14, 14), + (15, 1), + (15, 2), + (15, 3), + (15, 6), + (15, 11), + (15, 15), + (16, 1), + (16, 2), + (16, 3), + (16, 6), + (16, 11), + (16, 13), + (16, 14), + (16, 15), + (16, 16), + (17, 1), + (17, 2), + (17, 3), + (17, 5), + (17, 6), + (17, 11), + (17, 13), + (17, 14), + (17, 17), + (17, 18), + (17, 19), + (17, 20), + (17, 21), + (18, 1), + (18, 2), + (18, 3), + (18, 6), + (18, 11), + (18, 18), + (19, 1), + (19, 2), + (19, 3), + (19, 6), + (19, 11), + (19, 13), + (19, 14), + (19, 18), + (19, 19), + (19, 21), + (20, 1), + (20, 2), + (20, 3), + (20, 6), + (20, 11), + (20, 13), + (20, 14), + (20, 20), + (21, 1), + (21, 2), + (21, 3), + (21, 6), + (21, 11), + (21, 18), + (21, 21), + (22, 1), + (22, 2), + (22, 3), + (22, 6), + (22, 11), + (22, 13), + (22, 14), + (22, 18), + (22, 21), + (22, 22), + (30, 1), + (30, 2), + (30, 3), + (30, 5), + (30, 6), + (30, 11), + (30, 13), + (30, 14), + (30, 18), + (30, 19), + (30, 20), + (30, 21), + (30, 22), + (30, 30), + (31, 1), + (31, 2), + (31, 3), + (31, 6), + (31, 11), + (31, 31), + (32, 1), + (32, 2), + (32, 3), + (32, 6), + (32, 11), + (32, 32); + +INSERT INTO `account`.`roleInherit`(`role`, `inheritsFrom`) + VALUES + (9, 0), + (5, 1), + (13, 1), + (15, 1), + (18, 1), + (31, 1), + (32, 1), + (1, 2), + (5, 2), + (1, 3), + (17, 5), + (30, 5), + (11, 6), + (1, 11), + (2, 11), + (3, 11), + (16, 13), + (17, 13), + (19, 13), + (20, 13), + (22, 13), + (5, 14), + (13, 14), + (16, 15), + (21, 18), + (5, 19), + (17, 20), + (30, 20), + (19, 21), + (22, 21), + (30, 22); + +INSERT INTO `salix`.`ACL`(`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + (1, 'Account', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (2, 'Account', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (3, 'Address', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (4, 'Address', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (5, 'AgencyService', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (6, 'AgencyService', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (7, 'Client', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (8, 'Client', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (9, 'ClientObservation', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (10, 'ClientObservation', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (11, 'ContactChannel', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (12, 'ContactChannel', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (13, 'Employee', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (14, 'PayMethod', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (15, 'PayMethod', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (16, 'FakeProduction', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (17, 'Warehouse', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (18, 'State', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (19, 'FakeProduction', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (20, 'TicketState', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + (22, 'TicketState', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (23, 'TicketState', '*', 'EXECUTE', 'ALLOW', 'ROLE', 'employee'), + (24, 'Delivery', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), + (25, 'Zone', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`) + VALUES + (1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'), + (2, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@verdnatura.es'), + (3, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@verdnatura.es'), + (4, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@verdnatura.es'), + (5, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@verdnatura.es'), + (6, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'DavidCharlesHaller@verdnatura.es'), + (7, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@verdnatura.es'), + (8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'), + (9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'), + (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'), + (11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es'); + +INSERT INTO `salix`.`Country`(`id`, `name`, `inCee`, `code`, `currencyFk`, `realCountryFk`) + VALUES + (1, 'España', 0, 'ES', 1, 1), + (2, 'Italia', 1, 'IT', 1, 2), + (3, 'Alemania', 1, 'DE', 1, 3), + (4, 'Rumania', 1, 'RO', 1, 4), + (5, 'Holanda', 1, 'NL', 1, 5), + (30,'Francia', 1, 'FR', 1, 6); + +INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `isManaged`) + VALUES + (1, 'Warehouse One', 0, 1, 1), + (2, 'Warehouse Two', 0, 1, 1), + (3, 'Warehouse Three', 1, 1, 1), + (4, 'Warehouse Four', 1, 1, 1), + (5, 'Warehouse Five', 1, 1, 0); + +INSERT INTO `vn`.`warehouseAlias`(`id`, `name`) + VALUES + (1, 'Main Warehouse'); + +INSERT INTO `vn`.`accountingType`(`id`, `description`) + VALUES + (1, 'Digital money'), + (2, 'Cash'), + (3, 'Card'), + (4, 'Stolen Money'), + (5, 'Miscellaneous'); + +INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`) + VALUES + (8, 'Pay on receipt', '0000000000', 4, 0, 1); + +INSERT INTO `salix`.`Agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`) + VALUES + (1, 'inhouse pickup', 1, 0, 8, 1), + (2, 'Super-Man delivery', 1, 0, 8, 1), + (3, 'Teleportation device', 1, 0, 8, 1), + (4, 'Entanglement', 1, 0, 8, 1), + (5, 'Quantum break device', 1, 0, 8, 1), + (6, 'Walking', 1, 0, 8, 1); + +UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup'; +UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery'; +UPDATE `vn`.`agencyMode` SET `id` = 3 WHERE `name` = 'Teleportation device'; +UPDATE `vn`.`agencyMode` SET `id` = 4 WHERE `name` = 'Entanglement'; +UPDATE `vn`.`agencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device'; +UPDATE `vn`.`agencyMode` SET `id` = 6 WHERE `name` = 'Walking'; + +INSERT INTO `vn`.`payMethod`(`id`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`) + VALUES + (1, 'PayMethod one', 0, 001, 0), + (2, 'PayMethod two', 10, 001, 0), + (3, 'PayMethod three', 0, 001, 0), + (4, 'PayMethod with IBAN', 0, 001, 1), + (5, 'PayMethod five', 10, 001, 0); + +INSERT INTO `salix`.`Zone`(`id`, `name`, `printingOrder`) + VALUES + (1, 'zone one', 1), + (2, 'zone two', 2), + (3, 'zone three', 3); + +INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`, `zoneFk`) + VALUES + (1, 'Province one', 1, NULL, 1), + (2, 'Province two', 1, NULL, 2), + (3, 'Province three', 1, NULL, 3), + (4, 'Province four', 1, NULL, 2), + (5, 'Province five', 1, NULL, 1); + +INSERT INTO `vn`.`clientType`(`id`, `code`, `type`) + VALUES + (1, 'normal', 'Normal'), + (2, 'internalUse', 'Autoconsumo'), + (3, 'handMaking', 'Confección'), + (4, 'loses', 'Mermas'); + +INSERT INTO `vn`.`city`(`id`, `name`, `provinceFk`) + VALUES + (1, 'Gotham', 1); + +INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`) + VALUES + (1, 'NIF'); + +INSERT INTO `vn`.`worker`(`workerCode`, `id`, `firstName`, `name`, `userFk`) + VALUES + ('LGN', 1, 'David Charles', 'Haller', 6), + ('ANT', 2, 'Hank', 'Pym', 7), + ('DCX', 3, 'Charles', 'Xavier', 8), + ('HLK', 4, 'Bruce', 'Banner', 9), + ('JJJ', 5, 'Jessica', 'Jones', 10), + ('VSC', 20, 'Victor', 'Stone', 11); + +INSERT INTO `vn`.`contactChannel`(`id`, `name`) + VALUES + (1, 'Rumors on the streets'), + (2, 'Metropolis newspaper'), + (3, 'Daily Bugle'), + (4, 'GCN Channel'), + (5, 'The Newspaper'); + +INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`) + VALUES + (1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1), + (9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1), + (10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1); + +INSERT INTO `salix`.`Address`(`id`, `consignee`, `street`, `city`, `postcode`, `provinceFk`, `phone`, `mobile`, `isEnabled`, `isDefaultAddress`, `clientFk`, `defaultAgencyFk`, `longitude`, `latitude`, `isEqualizated`) + VALUES + (1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 0), + (2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0), + (3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0), + (4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0), + (5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0), + (6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0), + (7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0), + (8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0), + (9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0), + (10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0); + +INSERT INTO `salix`.`ClientCredit`(`id`, `clientFk`, `employeeFk`, `amount`, `created`) + VALUES + (1, 1, 1, 1200, CURDATE()), + (2, 2, 2, 800, CURDATE()), + (3, 3, 3, 200, CURDATE()), + (4, 4, 4, 90, CURDATE()), + (5, 5, 5, 90, CURDATE()); + +INSERT INTO `salix`.`ClientCreditLimit`(`id`, `maxAmount`, `roleFk`) + VALUES + (1, 1000, 5), + (2, 600, 5), + (3, 0, 5); + +INSERT INTO `salix`.`ClientObservation`(`id`, `clientFk`, `employeeFk`, `text`, `created`) + VALUES + (1, 1, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()), + (2, 2, 1, 'With great power, comes great responsibility', CURDATE()), + (3, 3, 2, 'this is a job for Super-Man!', CURDATE()), + (4, 4, 2, 'yes... I am Iron-Man', CURDATE()), + (5, 5, 3, 'They do understand. Our mutant powers make us superior', CURDATE()), + (6, 6, 3, 'My name is Legion, for we are many!', CURDATE()), + (7, 7, 4, 'I think our first move should be calling the Avengers..', CURDATE()), + (8, 8, 4, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()), + (9, 9, 5, 'HULK SMASH! ...', CURDATE()), + (10, 10, 5, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain.', CURDATE()); + +INSERT INTO `vn`.`observationType`(`id`,`description`) + VALUES + (1,'observation one'), + (2,'observation two'), + (3,'observation three'); + + INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`) + VALUES + (1, 1, 1,'under the floor'), + (2, 1, 2,'wears leather and goes out at night'), + (3, 1, 3,'care with the dog'); + +INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`) + VALUES + (1, 1, CURDATE(), CURDATE()), + (2, 2, CURDATE(), CURDATE()), + (3, 3, CURDATE(), CURDATE()), + (4, 4, CURDATE(), CURDATE()), + (5, 5, CURDATE(), CURDATE()); + +INSERT INTO `salix`.`Route`(`id`, `date`) + VALUES + (1, CURDATE()), + (2, CURDATE()), + (3, CURDATE()), + (4, CURDATE()), + (5, CURDATE()), + (6, CURDATE()), + (7, CURDATE()); + +INSERT INTO `salix`.`State`(`id`, `name`, `order`, `alertLevel`, `code`) + VALUES + (1, 'To check', 2, 0, 'FIXING'), + (2, 'Owes', 1, 0, 'FREE'), + (3, 'Ok', 3, 0, 'OK'); + +INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`) + VALUES + (1, 'Wayne Industries'); + +INSERT INTO `vn2008`.`empresa`(`id`, `abbreviation`, `registro`, `gerente_id`, `alta`, `baja`, `logo`, `oficial`, `cyc`, `rgb`, `mail`, `cuno`, `ODBC_DATE`, `Id_Cliente`, `digito_factura`, `Id_Proveedores_account`, `morosidad`, `empresa_grupo`) + VALUES + (442, 'WAY', 'Wayne Industries, Inc. operates as a warehouse for steel products.', '2', '1989-11-19', NULL, NULL, '1', '1', '00FF00', 'BruceWayne@verdnatura.es', NULL, '1989-08-11 12:31:22', '10', '1', NULL, '1', '1'); + + + INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `clientFk`,`nickname`, `addressFk`) + VALUES + (1, 1, 1, NULL, CURDATE(), 1, 'Batman', 1), + (2, 1, 1, NULL, CURDATE(), 1, 'Spider-Man', 2), + (3, 2, 2, NULL, CURDATE(), 2, 'Super-Man', 3), + (4, 2, 2, NULL, CURDATE(), 2, 'Iron-Man', 4), + (5, 3, 3, NULL, CURDATE(), 3, 'Magneto', 5), + (6, 3, 3, NULL, CURDATE(), 3, 'Legion', 6), + (7, 4, 4, NULL, CURDATE(), 4, 'Ant-Man', 7), + (8, 4, 4, NULL, CURDATE(), 4, 'Professor X', 8), + (9, 5, 5, NULL, CURDATE(), 5, 'Hulk', 9), + (10, 6, 5, NULL, CURDATE(), 5, 'Jessica Jones', 10); + +INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`) + VALUES + (1, 1, 1, 5, CURDATE()), + (2, 2, 2, 5, CURDATE()), + (3, 3, 3, 5, CURDATE()), + (4, 4, 1, 5, CURDATE()), + (5, 5, 2, 5, CURDATE()), + (6, 6, 3, 5, CURDATE()), + (7, 7, 1, 5, CURDATE()), + (8, 8, 2, 5, CURDATE()), + (9, 9, 3, 5, CURDATE()), + (10, 10, 1, 5, CURDATE()); + +INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`) + VALUES + (1, '3333-BAT', 'WAYNE INDUSTRIES', 'BATMOBILE', 442, 1, 'The ultimate war machine', 50, 1), + (2, '1111-IMK', 'STARK INDUSTRIES', 'MARK-III', 442, 1, 'Iron-Man Heavy Armor MARK-III', 18, 1), + (3, '2222-IMK', 'STARK INDUSTRIES', 'MARK-VI', 442, 1, 'Iron-Man Heavy Armor MARK-VI', 16, 1), + (4, '3333-IMK', 'STARK INDUSTRIES', 'MARK-VII', 442, 1, 'Iron-Man Heavy Armor MARK-VII', 14, 1), + (5, '4444-IMK', 'STARK INDUSTRIES', 'MARK-XLII', 442, 1, 'Iron-Man Heavy Armor MARK-XLII', 13, 1), + (6, '5555-IMK', 'STARK INDUSTRIES', 'MARK-XLV', 442, 1, 'Iron-Man Heavy Armor MARK-XLV', 12, 1); + +INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`) + VALUES + (1, 'beta-server', 'nightmare@verdnatura.es', '200'); + +INSERT INTO `vn`.`greugeType`(`id`, `name`) + VALUES + (1, 'Diff'), + (2, 'Recover'), + (3, 'Manna'), + (4, 'Reclaim'), + (5, 'Heritage'), + (6, 'Miscellaneous'); + +INSERT INTO `vn`.`greuge`(`id`, `clientFk`, `description`, `amount`, `shipped`, `created`, `greugeTypeFk`, `ticketFk`) + VALUES + (1, 1, 'some diff charges', 1000, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1), + (2, 1, 'some recovery charges', 1000, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2, 1), + (3, 1, 'some manna charges', 1000, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3, 1), + (4, 1, 'some claim charges', 1000, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4, 1), + (5, 1, 'some heritage charges', 1000, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5, 1), + (6, 1, 'some miscellaneous charges', 1000, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1, 1); + +INSERT INTO `vn`.`mandateType`(`id`, `name`) + VALUES + (1, 'B2B'), + (2, 'CORE'); + +INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `mandateTypeFk`) + VALUES + (1, 2, 442, '1-1', CURDATE(), 2); + +INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`) + VALUES + (1, 'Gear', 1, 'B92A26'), + (2, 'Items', 2, 'dcf711'); + +INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`) + VALUES + (1, 'ARM', 'Armor', 1, 15, 5), + (2, 'ITG', 'Infinity gem', 2, 30, 5), + (3, 'WPN', 'Weapon', 2, 30, 5); + +INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`) + VALUES + ('YEL', 'Yellow', 1 , 1), + ('BLU', 'Blue', 1 , 2), + ('RED', 'Red', 1 , 3); + +INSERT INTO `vn`.`origin`(`id`,`code`, `name`) + VALUES + (1, 'SPA', 'Spain'), + (2, 'HOL', 'Holand'), + (3, 'VLC', 'Valencia'); + +INSERT INTO `vn`.`producer`(`id`, `name`) + VALUES + (1, 'Marvel Studios'), + (2, 'Nordic Mythology'); + +INSERT INTO `vn`.`taxType`(`id`, `nickname`, `isAccrued`, `serial`, `TIPOOPE`, `description`, `countryFk`) + VALUES + (1, 'National', 1, 'R', 'I', 'national VAT',1), + (2, 'European', 0, 'E', 'I', 'europe VAT', 1); + +INSERT INTO `vn`.`taxCode`(`id`, `dated`, `code`, `taxTypeFk`, `rate`, `equalizationTax`, `type`, `link`, `isActive`, `updated`, `transactionCode`) + VALUES + (1, CURDATE(), '1111111111', 1, 7.0 , 0.0, 'R', 1, 1, CURDATE(), 1), + (2, CURDATE(), '2222222222', 2, 16.0, 0.0, 'G', 2, 1, CURDATE(), 2); + +INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`) + VALUES + (1, 'Reduced VAT','R'), + (2, 'General VAT', 'G'); + +INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) + VALUES + (1, 'Automatic armor', 1, 1), + (2, 'Magic weapon' , 2, 2); + +INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`) + VALUES + (1, 1, 'bail', 0), + (2, 1, 'loan', 1); + +INSERT INTO `vn`.`item`(`id`, `name`,`typeFk`,`size`,`inkFk`,`category`,`stems`,`originFk`,`description`,`producerFk`,`intrastatFk`,`isOnOffer`,`expenceFk`,`isBargain`,`comment`,`relevancy`,`image`,`taxClassFk`) + VALUES + (1, 'Gem of Time', 2, 70, 'AMA', 'EXT', 1, 1, 'One of the infinity gems', 1, 2, 0, 1, 0, NULL, 0, 66540, 1), + (2, 'Gem of Mind', 2, 70, 'AZL', 'EXT', 1, 2, 'One of the infinity gems', 1, 2, 0, 1, 0, NULL, 0, 65540, 1), + (3, 'Iron Patriot', 1, 60, 'AMR', 'EXT', 1, 3, 'Rhodeys armor', 1, 1, 0, 1, 0, NULL, 0, 61692, 1), + (4, 'Mark I', 1, 60, 'AMR', 'EXT', 1, 1, 'Iron Mans first armor', 1, 1, 1, 2, 0, NULL, 0, 66090, 2), + (5, 'Mjolnir', 3, 30, 'AZR', 'EXT', 1, 2, 'Thors hammer!', 2, 2, 1, 2, 0, NULL, 0, 67350, 2); + +INSERT INTO `salix`.`user`(`id`,`username`,`password`,`email`) + VALUES + (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 'JessicaJones@verdnatura.es'); + +INSERT INTO `vn`.`tag`(`id`,`name`,`free`,`isQuantitatif`,`sourceTable`,`unit`) + VALUES + (1, 'Color', 1, 0, null, null), + (2, 'Power', 1, 0, null, null), + (3, 'Shape', 1, 0, null, null), + (4, 'Location', 1, 0, null, null), + (5, 'Owner', 1, 1, null, null); + +INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) + VALUES + (1, 1, 1, 'Yellow', 5), + (2, 1, 2, 'Manipulates time', 4), + (3, 1, 3, 'round', 3), + (4, 1, 4, 'Gamoras hideout', 2), + (5, 1, 5, 'Gamora', 1); + +INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) + VALUES + ('1', '1', '1', 'insert', 'We made an change!'); \ No newline at end of file diff --git a/services/db/Dockerfile b/services/db/Dockerfile index 3826138f6..3b099daad 100644 --- a/services/db/Dockerfile +++ b/services/db/Dockerfile @@ -1,12 +1,12 @@ FROM mysql:5.6.37 ENV MYSQL_ALLOW_EMPTY_PASSWORD yes +ENV TZ GMT-1 -COPY localDB01Structure.sql /docker-entrypoint-initdb.d -COPY localDB02Inserts.sql /docker-entrypoint-initdb.d +COPY *.sql /docker-entrypoint-initdb.d/ RUN chmod -R 755 /docker-entrypoint-initdb.d CMD ["mysqld"] -EXPOSE 3306 \ No newline at end of file +EXPOSE 3306 diff --git a/services/db/connect.tpl.ini b/services/db/connect.tpl.ini new file mode 100644 index 000000000..cf960b425 --- /dev/null +++ b/services/db/connect.tpl.ini @@ -0,0 +1,5 @@ +[client] +host=localhost +port=3306 +user=root +password= \ No newline at end of file diff --git a/services/db/localDB02Inserts.sql b/services/db/localDB02Inserts.sql deleted file mode 100644 index dc859bfbf..000000000 --- a/services/db/localDB02Inserts.sql +++ /dev/null @@ -1,498 +0,0 @@ -INSERT INTO `account`.`role`(`id`, `name`, `description`) - VALUES - (1, 'employee', 'Privilegios básicos de un empleado'), - (2, 'customer', 'Privilegios básicos de un cliente'), - (3, 'agency', 'Consultar tablas de predicciones de bultos'), - (5, 'administrative', 'Tareas relacionadas con la contabilidad'), - (6, 'guest', 'Privilegios para usuarios sin cuenta'), - (9, 'developer', 'Desarrolladores del sistema'), - (11, 'account', 'Privilegios relacionados con el login'), - (13, 'teamBoss', 'Jefe de departamento'), - (14, 'manageEmployee', 'Privilegios para gestión de empleados'), - (15, 'logistic', 'Departamento de logística'), - (16, 'logisticBoss', 'Jefe del departamento de logística'), - (17, 'adminBoss', 'Jefe del departamento de administración'), - (18, 'salesPerson', 'Departamento de ventas'), - (19, 'salesBoss', 'Jefe del departamento de ventas'), - (20, 'manager', 'Departamento de gerencia'), - (21, 'salesAssistant', 'Jefe auxiliar de ventas'), - (22, 'teamManager', 'Jefe de departamento con privilegios de auxiliar de venta.'), - (30, 'financialBoss', 'Director finaciero'), - (31, 'freelancer', 'Trabajadores por cuenta ajena'), - (32, 'ett', 'Trabajadores de empresa temporal'), - (33, 'root', 'Rol con todos los privilegios'); - -UPDATE `account`.`role` SET `id` = 0 WHERE `id` = 33; - -INSERT INTO `account`.`roleRole`(`role`, `inheritsFrom`) - VALUES - (0, 0), - (0, 1), - (0, 2), - (0, 3), - (0, 5), - (0, 6), - (0, 9), - (0, 11), - (0, 13), - (0, 14), - (0, 15), - (0, 16), - (0, 17), - (0, 18), - (0, 19), - (0, 20), - (0, 21), - (0, 22), - (0, 30), - (0, 31), - (0, 32), - (1, 1), - (1, 2), - (1, 3), - (1, 6), - (1, 11), - (2, 2), - (2, 6), - (2, 11), - (3, 3), - (3, 6), - (3, 11), - (5, 1), - (5, 2), - (5, 3), - (5, 5), - (5, 6), - (5, 11), - (5, 13), - (5, 14), - (5, 18), - (5, 19), - (5, 21), - (6, 6), - (9, 0), - (9, 1), - (9, 2), - (9, 3), - (9, 5), - (9, 6), - (9, 9), - (9, 11), - (9, 13), - (9, 14), - (9, 15), - (9, 16), - (9, 17), - (9, 18), - (9, 19), - (9, 20), - (9, 21), - (9, 22), - (9, 30), - (9, 31), - (9, 32), - (11, 6), - (11, 11), - (13, 1), - (13, 2), - (13, 3), - (13, 6), - (13, 11), - (13, 13), - (13, 14), - (14, 14), - (15, 1), - (15, 2), - (15, 3), - (15, 6), - (15, 11), - (15, 15), - (16, 1), - (16, 2), - (16, 3), - (16, 6), - (16, 11), - (16, 13), - (16, 14), - (16, 15), - (16, 16), - (17, 1), - (17, 2), - (17, 3), - (17, 5), - (17, 6), - (17, 11), - (17, 13), - (17, 14), - (17, 17), - (17, 18), - (17, 19), - (17, 20), - (17, 21), - (18, 1), - (18, 2), - (18, 3), - (18, 6), - (18, 11), - (18, 18), - (19, 1), - (19, 2), - (19, 3), - (19, 6), - (19, 11), - (19, 13), - (19, 14), - (19, 18), - (19, 19), - (19, 21), - (20, 1), - (20, 2), - (20, 3), - (20, 6), - (20, 11), - (20, 13), - (20, 14), - (20, 20), - (21, 1), - (21, 2), - (21, 3), - (21, 6), - (21, 11), - (21, 18), - (21, 21), - (22, 1), - (22, 2), - (22, 3), - (22, 6), - (22, 11), - (22, 13), - (22, 14), - (22, 18), - (22, 21), - (22, 22), - (30, 1), - (30, 2), - (30, 3), - (30, 5), - (30, 6), - (30, 11), - (30, 13), - (30, 14), - (30, 18), - (30, 19), - (30, 20), - (30, 21), - (30, 22), - (30, 30), - (31, 1), - (31, 2), - (31, 3), - (31, 6), - (31, 11), - (31, 31), - (32, 1), - (32, 2), - (32, 3), - (32, 6), - (32, 11), - (32, 32); - -INSERT INTO `account`.`roleInherit`(`role`, `inheritsFrom`) - VALUES - (9, 0), - (5, 1), - (13, 1), - (15, 1), - (18, 1), - (31, 1), - (32, 1), - (1, 2), - (5, 2), - (1, 3), - (17, 5), - (30, 5), - (11, 6), - (1, 11), - (2, 11), - (3, 11), - (16, 13), - (17, 13), - (19, 13), - (20, 13), - (22, 13), - (5, 14), - (13, 14), - (16, 15), - (21, 18), - (5, 19), - (17, 20), - (30, 20), - (19, 21), - (22, 21), - (30, 22); - -INSERT INTO `salix`.`ACL`(`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES - (1, 'Account', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (2, 'Account', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (3, 'Address', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (4, 'Address', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (5, 'AgencyService', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (6, 'AgencyService', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (7, 'Client', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (8, 'Client', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (9, 'ClientObservation', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (10, 'ClientObservation', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (11, 'ContactChannel', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (12, 'ContactChannel', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (13, 'Employee', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (14, 'PayMethod', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (15, 'PayMethod', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (16, 'FakeProduction', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (17, 'Warehouse', '* ', 'READ', 'ALLOW', 'ROLE', 'employee'), - (18, 'State', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (19, 'FakeProduction', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (20, 'TicketState', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - (22, 'TicketState', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (23, 'TicketState', '*', 'EXECUTE', 'ALLOW', 'ROLE', 'employee'), - (24, 'Delivery', '*', 'READ', 'ALLOW', 'ROLE', 'employee'), - (25, 'Zone', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); - -INSERT INTO `salix`.`Account`(`id`,`name`,`password`,`roleFk`,`active`,`email`) - VALUES - (1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'), - (2, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@verdnatura.es'), - (3, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@verdnatura.es'), - (4, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@verdnatura.es'), - (5, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@verdnatura.es'), - (6, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@verdnatura.es'), - (7, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@verdnatura.es'), - (8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'), - (9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@verdnatura.es'), - (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'); - -INSERT INTO `salix`.`Country`(`id`, `name`, `inCee`, `code`, `currencyFk`, `realCountryFk`) - VALUES - (1, 'España', 0, 'ES', 1, 1), - (2, 'Italia', 1, 'IT', 1, 2), - (3, 'Alemania', 1, 'DE', 1, 3), - (4, 'Rumania', 1, 'RO', 1, 4), - (5, 'Holanda', 1, 'NL', 1, 5); - -INSERT INTO `salix`.`Warehouse`(`id`, `name`, `tpv`, `inventory`, `isManaged`) - VALUES - (1, 'Warehouse One', 01, 1, 1), - (2, 'Warehouse Two', 01, 1, 1), - (3, 'Warehouse Three', 01, 1, 1), - (4, 'Warehouse Four', 01, 1, 1), - (5, 'Warehouse Five', 01, 1, 0); - -INSERT INTO `salix`.`WarehouseAlias`(`id`, `name`) - VALUES - (1, 'Main Warehouse'); - -INSERT INTO `vn`.`accountingType`(`id`, `description`) - VALUES - (1, 'Digital money'), - (2, 'Cash'), - (3, 'Card'), - (4, 'Stolen Money'), - (5, 'Miscellaneous'); - -INSERT INTO `salix`.`Bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`) - VALUES - (8, 'Pay on receipt', '0000000000', 4, 0, 1); - -INSERT INTO `salix`.`Agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`) - VALUES - (1, 'inhouse pickup', 1, 0, 8, 1), - (2, 'Super-Man delivery', 1, 0, 8, 1), - (3, 'Teleportation device', 1, 0, 8, 1), - (4, 'Entanglement', 1, 0, 8, 1), - (5, 'Quantum break device', 1, 0, 8, 1), - (6, 'Walking', 1, 0, 8, 1); - -UPDATE `salix`.`AgencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup'; -UPDATE `salix`.`AgencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery'; -UPDATE `salix`.`AgencyMode` SET `id` = 3 WHERE `name` = 'Teleportation device'; -UPDATE `salix`.`AgencyMode` SET `id` = 4 WHERE `name` = 'Entanglement'; -UPDATE `salix`.`AgencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device'; -UPDATE `salix`.`AgencyMode` SET `id` = 6 WHERE `name` = 'Walking'; - -INSERT INTO `salix`.`PayMethod`(`id`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`) - VALUES - (1, 'PayMethod one', 0, 001, 0), - (2, 'PayMethod two', 10, 001, 0), - (3, 'PayMethod three', 0, 001, 0), - (4, 'PayMethod four', 0, 001, 1), - (5, 'PayMethod five', 10, 001, 0); - -INSERT INTO `salix`.`Zone`(`id`, `name`, `printingOrder`) - VALUES - (1, 'zone one', 1), - (2, 'zone two', 2), - (3, 'zone three', 3); - -INSERT INTO `salix`.`Province`(`id`, `name`, `countryFk`, `warehouseFk`, `zoneFk`) - VALUES - (1, 'Province one', 1, NULL, 1), - (2, 'Province two', 1, NULL, 2), - (3, 'Province three', 1, NULL, 3), - (4, 'Province four', 1, NULL, 2), - (5, 'Province five', 1, NULL, 1); - -INSERT INTO `salix`.`ClientType`(`id`, `code`, `type`) - VALUES - (1, 'normal', 'Normal'), - (2, 'internalUse', 'Autoconsumo'), - (3, 'handMaking', 'Confección'), - (4, 'loses', 'Mermas'); - -INSERT INTO `salix`.`City`(`id`, `name`, `provinceFk`) - VALUES - (1, 'Gotham', 1); - - -INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`) - VALUES - (1, 'NIF'); - -INSERT INTO `vn2008`.`Trabajadores`(`CodigoTrabajador`, `Id_Trabajador`, `Nombre`, `Apellidos`, `user`) - VALUES - ('LGN', 1, 'David Charles', 'Haller', 6), - ('ANT', 2, 'Hank', 'Pym', 7), - ('DCX', 3, 'Charles', 'Xavier', 8), - ('HLK', 4, 'Bruce', 'Banner', 9), - ('JJJ', 5, 'Jessica', 'Jones', 10); - -INSERT INTO `salix`.`ContactChannel`(`id`, `name`) - VALUES - (1, 'Rumors on the streets'), - (2, 'Metropolis newspaper'), - (3, 'Daily Bugle'), - (4, 'GCN Channel'), - (5, 'The Newspaper'); - -INSERT INTO `salix`.`Client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `provinceFk`, `countryFk`, `email`, `phone`, `mobile`, `fax`, `active`, `discount`, `credit`, `creditInsurance`, `iban`, `dueDay`, `equalizationTax`, `hasToInvoice`, `invoiceByEmail`, `payMethodFk`, `salesPersonFk`, `contactChannelFk`, `sepaVnl`, `coreVnl`, `coreVnh`, `eypbc`, `quality`, `vies`, `isRelevant`, `typeFk`, `accountingAccount`, `created`) - VALUES - (1, 'Bruce Wayne', '11111111B', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1, 'BruceWayne@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (2, 'Petter Parker', '22222222P', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1, 1, 'PetterParker@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (3, 'Clark Kent', '33333333C', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1, 1, 'ClarkKent@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (4, 'Tony Stark', '44444444T', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1, 1, 'TonyStark@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (5, 'Max Eisenhardt', '55555555M', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1, 1, 'MaxEisenhardt@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (6, 'DavidCharlesHaller', '66666666D', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1, 1, 'DavidCharlesHaller@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (7, 'Hank Pym', '77777777H', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1, 1, 'HankPym@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (8, 'Charles Xavier', '88888888C', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1, 1, 'CharlesXavier@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (9, 'Bruce Banner', '99999999B', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1, 1, 'BruceBanner@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()), - (10, 'Jessica Jones', '10101010J', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1, 1, 'JessicaJones@verdnatura.es', 1111111111, 222222222, 333333333, 1, 1, 300, NULL, NULL, 0, 1, 1, 1, 5, 4, 5, 1, 1, 1, 1, 10, 0, 1, 1, 1234567890, CURDATE()); - -INSERT INTO `salix`.`Address`(`id`, `consignee`, `street`, `city`, `postcode`, `provinceFk`, `phone`, `mobile`, `isEnabled`, `isDefaultAddress`, `clientFk`, `defaultAgencyFk`, `longitude`, `latitude`, `isEqualizated`) - VALUES - (1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 1), - (2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 1), - (3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 1), - (4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 1), - (5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 1), - (6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 1), - (7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 1), - (8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 1), - (9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 1), - (10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 1); - -INSERT INTO `salix`.`ClientCredit`(`id`, `clientFk`, `employeeFk`, `amount`, `created`) - VALUES - (1, 1, 1, 1200, CURDATE()), - (2, 2, 2, 800, CURDATE()), - (3, 3, 3, 200, CURDATE()), - (4, 4, 4, 90, CURDATE()), - (5, 5, 5, 90, CURDATE()); - -INSERT INTO `salix`.`ClientCreditLimit`(`id`, `maxAmount`, `roleFk`) - VALUES - (1, 10000, 5), - (2, 600, 5), - (3, 0, 5); - -INSERT INTO `salix`.`ClientObservation`(`id`, `clientFk`, `employeeFk`, `text`, `created`) - VALUES - (1, 1, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()), - (2, 2, 1, 'With great power, comes great responsibility', CURDATE()), - (3, 3, 2, 'this is a job for Super-Man!', CURDATE()), - (4, 4, 2, 'yes... I am Iron-Man', CURDATE()), - (5, 5, 3, 'They do understand. Our mutant powers make us superior', CURDATE()), - (6, 6, 3, 'My name is Legion, for we are many!', CURDATE()), - (7, 7, 4, 'I think our first move should be calling the Avengers..', CURDATE()), - (8, 8, 4, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()), - (9, 9, 5, 'HULK SMASH! ...', CURDATE()), - (10, 10, 5, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain. Problem is, you dont always know that you have crossed that line.', CURDATE()); - -INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`) - VALUES - (1, 1, CURDATE(), CURDATE()), - (2, 2, CURDATE(), CURDATE()), - (3, 3, CURDATE(), CURDATE()), - (4, 4, CURDATE(), CURDATE()), - (5, 5, CURDATE(), CURDATE()); - -INSERT INTO `salix`.`Route`(`id`, `date`) - VALUES - (1, CURDATE()), - (2, CURDATE()), - (3, CURDATE()), - (4, CURDATE()), - (5, CURDATE()), - (6, CURDATE()), - (7, CURDATE()); - -INSERT INTO `salix`.`State`(`id`, `name`, `order`, `alertLevel`, `code`) - VALUES - (1, 'To check', 2, 0, 'FIXING'), - (2, 'Owes', 1, 0, 'FREE'), - (3, 'Ok', 3, 0, 'OK'); - -INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`) - VALUES - (1, 'Wayne Industries'); - -INSERT INTO `vn2008`.`empresa`(`id`, `abbreviation`, `registro`, `gerente_id`, `alta`, `baja`, `logo`, `oficial`, `cyc`, `rgb`, `mail`, `cuno`, `ODBC_DATE`, `Id_Cliente`, `digito_factura`, `Id_Proveedores_account`, `morosidad`, `empresa_grupo`) - VALUES - ('442', 'VNL', 'Wayne Industries, Inc. operates as a warehouse for steel products. Wayne Industries, Inc. was founded in 1989 and is based in Wayne, Michigan.', '2', '1989-11-19', NULL, NULL, '1', '1', '00FF00', 'BruceWayne@verdnatura.es', NULL, '1989-08-11 12:31:22', '10', '1', NULL, '1', '1'); - - INSERT INTO `salix`.`Ticket`(`id`, `agencyFk`, `employeeFk`, `date`, `hour`, `clientFk`, `addressFk`) - VALUES - (1, 1, 1, CURDATE(), 0, 1, 1), - (2, 1, 1, CURDATE(), 0, 1, 2), - (3, 2, 2, CURDATE(), 0, 2, 3), - (4, 2, 2, CURDATE(), 0, 2, 4), - (5, 3, 3, CURDATE(), 0, 3, 5), - (6, 3, 3, CURDATE(), 0, 3, 6), - (7, 4, 4, CURDATE(), 0, 4, 7), - (8, 4, 4, CURDATE(), 0, 4, 8), - (9, 5, 5, CURDATE(), 0, 5, 9), - (10, 6, 5, CURDATE(), 0, 5, 10); - -INSERT INTO `salix`.`TicketState`(`id`, `ticketFk`, `stateFk`, `employeeFk`, `updated`) - VALUES - (1, 1, 1, 1, CURDATE()), - (2, 2, 2, 1, CURDATE()), - (3, 3, 3, 2, CURDATE()), - (4, 4, 1, 2, CURDATE()), - (5, 5, 2, 3, CURDATE()), - (6, 6, 3, 3, CURDATE()), - (7, 7, 1, 4, CURDATE()), - (8, 8, 2, 4, CURDATE()), - (9, 9, 3, 5, CURDATE()), - (10, 10, 1, 5, CURDATE()); - -INSERT INTO `salix`.`Vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`) - VALUES - (1, '3333-BAT', 'WAYNE INDUSTRIES', 'BATMOBILE', 442, 1, 'The ultimate war machine', 50, 1), - (2, '1111-IMK', 'STARK INDUSTRIES', 'MARK-III', 442, 1, 'Iron-Man Heavy Armor MARK-III', 18, 1), - (3, '2222-IMK', 'STARK INDUSTRIES', 'MARK-VI', 442, 1, 'Iron-Man Heavy Armor MARK-VI', 16, 1), - (4, '3333-IMK', 'STARK INDUSTRIES', 'MARK-VII', 442, 1, 'Iron-Man Heavy Armor MARK-VII', 14, 1), - (5, '4444-IMK', 'STARK INDUSTRIES', 'MARK-XLII', 442, 1, 'Iron-Man Heavy Armor MARK-XLII', 13, 1), - (6, '5555-IMK', 'STARK INDUSTRIES', 'MARK-XLV', 442, 1, 'Iron-Man Heavy Armor MARK-XLV', 12, 1); - -INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`) - VALUES -(1, 'beta-server', 'nightmare@verdnatura.es', '200'); \ No newline at end of file diff --git a/services/db/script.cmd b/services/db/script.cmd new file mode 100755 index 000000000..2c7090522 --- /dev/null +++ b/services/db/script.cmd @@ -0,0 +1,2 @@ + +mysqldump --defaults-extra-file=connect.ini --default-character-set=utf8 --no-data --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera > 01-structure.sql diff --git a/services/db/testing_fixtures.js b/services/db/testing_fixtures.js new file mode 100644 index 000000000..9b7fa6b65 --- /dev/null +++ b/services/db/testing_fixtures.js @@ -0,0 +1,41 @@ +let mysql = require('mysql'); + +let connection = mysql.createConnection({ + multipleStatements: true, + host: 'localhost', + user: 'root', + password: '', + database: 'salix' +}); + +let errorHandler = callback => { + return error => { + if (error) + throw error; + callback(); + }; +}; + +let insertFixtures = (inserts, callback) => { + connection.query(inserts[0], errorHandler(callback)); + // connection.query('SET FOREIGN_KEY_CHECKS = 1'); +}; + +let truncate = (tables, callback) => { + let truncatesSQL = tables.reduce((accumulator, currentValue, i) => { + let sql = 'TRUNCATE TABLE ' + currentValue + '; '; + return (`${accumulator}${sql}`); + }, ''); + + connection.query(truncatesSQL.slice(0, -2), errorHandler(callback)); +}; + +connection.connect(); + +module.exports = function restoreFixtures(fixturesToApply, callback) { + connection.query('SET FOREIGN_KEY_CHECKS = 0', () => { + truncate(fixturesToApply.tables, () => { + insertFixtures(fixturesToApply.inserts, callback); + }); + }); +}; diff --git a/services/item/common/methods/item/filter.js b/services/item/common/methods/item/filter.js new file mode 100644 index 000000000..5db641a04 --- /dev/null +++ b/services/item/common/methods/item/filter.js @@ -0,0 +1,31 @@ +module.exports = Self => { + Self.installMethod('filter', filterParams); + + function filterParams(params) { + let filter = { + where: {}, + skip: (params.page - 1) * params.size, + limit: params.size, + order: params.order || 'relevancy DESC', + include: { + relation: "itemType", + scope: { + fields: ["id", "name"] + } + } + }; + + delete params.page; + delete params.size; + delete params.order; + + if (params.itemSize) { + filter.where.size = params.itemSize; + delete params.itemSize; + } + + Object.assign(filter.where, params); + + return filter; + } +}; diff --git a/services/item/common/methods/item/getLog.js b/services/item/common/methods/item/getLog.js new file mode 100644 index 000000000..50d563c08 --- /dev/null +++ b/services/item/common/methods/item/getLog.js @@ -0,0 +1,27 @@ +module.exports = Self => { + Self.remoteMethod('itemLog', { + description: 'Returns the item changes log', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The item id', + http: {source: 'path'} + }], + returns: { + arg: 'data', + type: ['Object'], + root: true + }, + http: { + path: `/:id/itemLog`, + verb: 'get' + } + }); + + Self.itemLog = itemFk => { + let query = `SELECT * FROM vn.itemLog WHERE itemFk = ?`; + return Self.rawSql(query, [itemFk]); + }; +}; diff --git a/services/item/common/models/expence.json b/services/item/common/models/expence.json new file mode 100644 index 000000000..a8bf47569 --- /dev/null +++ b/services/item/common/models/expence.json @@ -0,0 +1,29 @@ +{ + "name": "Expence", + "base": "VnModel", + "options": { + "mysql": { + "table": "expence" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "name": { + "type": "String" + }, + "isWithheld": { + "type": "Number" + } + }, + "relations": { + "taxType": { + "type": "belongsTo", + "model": "TaxType", + "foreignKey": "taxTypeFk" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/ink.json b/services/item/common/models/ink.json new file mode 100644 index 000000000..7b8647369 --- /dev/null +++ b/services/item/common/models/ink.json @@ -0,0 +1,22 @@ +{ + "name": "Ink", + "base": "VnModel", + "options": { + "mysql": { + "table": "ink" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "String" + }, + "showOrder": { + "type": "number" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/intrastat.json b/services/item/common/models/intrastat.json new file mode 100644 index 000000000..38347031d --- /dev/null +++ b/services/item/common/models/intrastat.json @@ -0,0 +1,31 @@ +{ + "name": "Intrastat", + "base": "VnModel", + "options": { + "mysql": { + "table": "intrastat" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "String" + } + }, + "relations": { + "taxClass": { + "type": "belongsTo", + "model": "TaxClass", + "foreignKey": "taxClassFk" + }, + "taxCode": { + "type": "belongsTo", + "model": "TaxCode", + "foreignKey": "taxCodeFk" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/item-type.json b/services/item/common/models/item-type.json new file mode 100644 index 000000000..d72fdba69 --- /dev/null +++ b/services/item/common/models/item-type.json @@ -0,0 +1,22 @@ +{ + "name": "ItemType", + "base": "VnModel", + "options": { + "mysql": { + "table": "itemType" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "String" + }, + "life": { + "type": "Number" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/item.js b/services/item/common/models/item.js new file mode 100644 index 000000000..3cbc622bd --- /dev/null +++ b/services/item/common/models/item.js @@ -0,0 +1,7 @@ +module.exports = function(Self) { + require('../methods/item/filter.js')(Self); + require('../methods/item/getLog.js')(Self); + + Self.validatesPresenceOf('name', {message: 'Cannot be blank'}); + Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); +}; diff --git a/services/item/common/models/item.json b/services/item/common/models/item.json new file mode 100644 index 000000000..6944a5eea --- /dev/null +++ b/services/item/common/models/item.json @@ -0,0 +1,89 @@ +{ + "name": "Item", + "base": "VnModel", + "options": { + "mysql": { + "table": "item" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "String", + "required": true + }, + "size": { + "type": "Number" + }, + "category": { + "type": "String" + }, + "stems": { + "type": "Number" + }, + "description": { + "type": "String" + }, + "isOnOffer": { + "type": "Boolean" + }, + "isBargain": { + "type": "Boolean" + }, + "comment": { + "type": "String" + }, + "relevancy": { + "type": "Number" + }, + "image": { + "type": "String" + } + }, + "relations": { + "itemType": { + "type": "belongsTo", + "model": "ItemType", + "foreignKey": "typeFk" + }, + "ink": { + "type": "belongsTo", + "model": "Ink", + "foreignKey": "inkFk" + }, + "origin": { + "type": "belongsTo", + "model": "Origin", + "foreignKey": "originFk" + }, + "producer": { + "type": "belongsTo", + "model": "Producer", + "foreignKey": "producerFk" + }, + "intrastat": { + "type": "belongsTo", + "model": "Intrastat", + "foreignKey": "intrastatFk" + }, + "expence": { + "type": "belongsTo", + "model": "Expence", + "foreignKey": "expenceFk" + }, + "taxClass": { + "type": "belongsTo", + "model": "TaxClass", + "foreignKey": "taxClassFk" + }, + "itemTag": { + "type": "hasMany", + "model": "ItemTag", + "foreignKey": "itemFk" + } + } + } \ No newline at end of file diff --git a/services/item/common/models/itemTag.json b/services/item/common/models/itemTag.json new file mode 100644 index 000000000..3de8dc1aa --- /dev/null +++ b/services/item/common/models/itemTag.json @@ -0,0 +1,36 @@ +{ + "name": "ItemTag", + "base": "VnModel", + "options": { + "mysql": { + "table": "itemTag", + "database": "vn" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "value": { + "type": "String", + "required": true + }, + "priority": { + "type": "Number" + } + }, + "relations": { + "item": { + "type": "belongsTo", + "model": "Item", + "foreignKey": "itemFk" + }, + "tag": { + "type": "belongsTo", + "model": "Tag", + "foreignKey": "tagFk" + } + } + } diff --git a/services/item/common/models/origin.json b/services/item/common/models/origin.json new file mode 100644 index 000000000..9860d677f --- /dev/null +++ b/services/item/common/models/origin.json @@ -0,0 +1,22 @@ +{ + "name": "Origin", + "base": "VnModel", + "options": { + "mysql": { + "table": "origin" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "code": { + "type": "String" + }, + "name": { + "type": "String" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/producer.json b/services/item/common/models/producer.json new file mode 100644 index 000000000..941b50842 --- /dev/null +++ b/services/item/common/models/producer.json @@ -0,0 +1,19 @@ +{ + "name": "Producer", + "base": "VnModel", + "options": { + "mysql": { + "table": "producer" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "String" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/tag.json b/services/item/common/models/tag.json new file mode 100644 index 000000000..3a2097f97 --- /dev/null +++ b/services/item/common/models/tag.json @@ -0,0 +1,30 @@ +{ + "name": "Tag", + "base": "VnModel", + "options": { + "mysql": { + "table": "tag", + "database": "vn" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "String", + "required": true + }, + "free": { + "type": "Number" + }, + "sourceTable": { + "type": "String" + }, + "unit": { + "type": "String" + } + } + } diff --git a/services/item/common/models/tax-class.json b/services/item/common/models/tax-class.json new file mode 100644 index 000000000..d5746d699 --- /dev/null +++ b/services/item/common/models/tax-class.json @@ -0,0 +1,22 @@ +{ + "name": "TaxClass", + "base": "VnModel", + "options": { + "mysql": { + "table": "taxClass" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "description": { + "type": "String" + }, + "code": { + "type": "String" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/tax-code.json b/services/item/common/models/tax-code.json new file mode 100644 index 000000000..d2c803ea5 --- /dev/null +++ b/services/item/common/models/tax-code.json @@ -0,0 +1,46 @@ +{ + "name": "TaxCode", + "base": "VnModel", + "options": { + "mysql": { + "table": "taxCode" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "dated": { + "type": "date" + }, + "code": { + "type": "String" + }, + "rate": { + "type": "number" + }, + "equalizationTax": { + "type": "number" + }, + "type": { + "type": "String" + }, + "isActive": { + "type": "Boolean" + } + }, + "relations": { + "taxType": { + "type": "belongsTo", + "model": "TaxType", + "foreignKey": "taxTypeFk" + }, + "link": { + "type": "belongsTo", + "model": "Link", + "foreignKey": "linkFk" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/tax-type.json b/services/item/common/models/tax-type.json new file mode 100644 index 000000000..e8573156d --- /dev/null +++ b/services/item/common/models/tax-type.json @@ -0,0 +1,35 @@ +{ + "name": "TaxType", + "base": "VnModel", + "options": { + "mysql": { + "table": "taxType" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "nickname": { + "type": "String" + }, + "serial": { + "type": "String" + }, + "TIPOOPE": { + "type": "String" + }, + "description": { + "type": "String" + } + }, + "relations": { + "country": { + "type": "belongsTo", + "model": "Country", + "foreignKey": "countryFk" + } + } +} \ No newline at end of file diff --git a/services/item/package.json b/services/item/package.json new file mode 100644 index 000000000..7a9c9b48a --- /dev/null +++ b/services/item/package.json @@ -0,0 +1,19 @@ +{ + "name": "vn-item", + "version": "1.0.0", + "main": "server/server.js", + "scripts": { + "lint": "eslint .", + "start": "node .", + "posttest": "npm run lint && nsp check" + }, + "repository": { + "type": "git", + "url": "https://git.verdnatura.es/salix" + }, + "license": "GPL-3.0", + "description": "vn-item", + "dependencies": { + "uuid": "^3.1.0" + } +} diff --git a/services/item/server/model-config.json b/services/item/server/model-config.json new file mode 100644 index 000000000..f001fcba1 --- /dev/null +++ b/services/item/server/model-config.json @@ -0,0 +1,38 @@ +{ + "Item": { + "dataSource": "vn" + }, + "ItemType": { + "dataSource": "vn" + }, + "Ink": { + "dataSource": "vn" + }, + "Origin": { + "dataSource": "vn" + }, + "Producer": { + "dataSource": "vn" + }, + "Intrastat": { + "dataSource": "vn" + }, + "TaxClass": { + "dataSource": "vn" + }, + "TaxCode": { + "dataSource": "vn" + }, + "TaxType": { + "dataSource": "vn" + }, + "Expence": { + "dataSource": "vn" + }, + "ItemTag": { + "dataSource": "vn" + }, + "Tag": { + "dataSource": "vn" + } +} diff --git a/services/item/server/server.js b/services/item/server/server.js new file mode 100644 index 000000000..f0493dcd9 --- /dev/null +++ b/services/item/server/server.js @@ -0,0 +1,4 @@ +var vnLoopback = require('../../loopback/server/server.js'); + +var app = module.exports = vnLoopback.loopback(); +vnLoopback.boot(app, __dirname, module); diff --git a/services/loopback/common/helpers.js b/services/loopback/common/helpers.js new file mode 100644 index 000000000..49dedffa4 --- /dev/null +++ b/services/loopback/common/helpers.js @@ -0,0 +1,23 @@ + +exports.UserError = class extends Error { + constructor(message) { + super(message); + this.statusCode = 400; + } +}; + +exports.getFinalState = function(ctx) { + if (ctx.isNewInstance) + return ctx.instance; + if (ctx.currentInstance) + return Object.assign({}, + ctx.currentInstance.__data, + ctx.data || ctx.instance + ); + + return null; +}; + +exports.isMultiple = function(ctx) { + return !ctx.isNewInstance && !ctx.currentInstance; +}; diff --git a/services/loopback/common/locale/en.json b/services/loopback/common/locale/en.json new file mode 100644 index 000000000..18e98b233 --- /dev/null +++ b/services/loopback/common/locale/en.json @@ -0,0 +1,8 @@ +{ + "PHONE_INVALID_FORMAT": "The phone format is invalid", + "You are not allowed to change the credit": "You are not allowed to change the credit", + "Unable to mark the equivalence surcharge": "Unable to mark the equivalence surcharge", + "The default consignee can not be unchecked": "The default consignee can not be unchecked", + "Unable to default a disabled consignee": "Unable to default a disabled consignee", + "El método de pago seleccionado requiere que se especifique el IBAN": "El método de pago seleccionado requiere que se especifique el IBAN" +} \ No newline at end of file diff --git a/services/loopback/common/locale/es.json b/services/loopback/common/locale/es.json new file mode 100644 index 000000000..ee023dcf7 --- /dev/null +++ b/services/loopback/common/locale/es.json @@ -0,0 +1,8 @@ +{ + "PHONE_INVALID_FORMAT": "El formato del teléfono no es correcto", + "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", + "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", + "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", + "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", + "El método de pago seleccionado requiere que se especifique el IBAN": "El método de pago seleccionado requiere que se especifique el IBAN" +} \ No newline at end of file diff --git a/services/loopback/common/methods/agency/list.js b/services/loopback/common/methods/agency/list.js deleted file mode 100644 index 591ea68f7..000000000 --- a/services/loopback/common/methods/agency/list.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function(Self) { - Self.defineScope({where: {isManaged: {neq: 0}}}); -}; diff --git a/services/loopback/common/methods/client/activate.js b/services/loopback/common/methods/client/activate.js new file mode 100644 index 000000000..acc89d6d0 --- /dev/null +++ b/services/loopback/common/methods/client/activate.js @@ -0,0 +1,62 @@ +var request = require('request'); + +module.exports = function(Self) { + Self.remoteMethod('activate', { + description: 'Activate or deactive client', + accepts: [ + { + arg: 'id', + type: 'number', + required: true, + description: 'Model id', + http: {source: 'path'} + }, { + arg: 'context', + type: 'object', + http: function(ctx) { + return ctx; + } + } + ], + returns: { + arg: 'active', + type: 'boolean' + }, + http: { + verb: 'put', + path: '/:id/activate' + } + }); + + Self.activate = function(id, ctx, cb) { + Self.findById(id, function(err, client) { + if (err) return cb(err); + + Self.update({id: client.id}, {active: !client.active}); + + let filter = {where: {clientFk: client.id}, fields: ['started', 'ended']}; + + Self.app.models.CreditClassification.findOne(filter, function(error, data) { + if (error) return; + + let currentDate = new Date(); + + if (data && client.active && (data.ended >= currentDate || data.ended == null)) { + let referer = ctx.req.headers.referer; + var options = { + url: `${referer}/mailer/notification/client-deactivate/${client.id}`, + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Authorization: ctx.req.headers.authorization + }, + json: {} + }; + request(options); + } + }); + + cb(null, !client.active); + }); + }; +}; diff --git a/services/loopback/common/methods/client/activeSalesPerson.js b/services/loopback/common/methods/client/activeSalesPerson.js new file mode 100644 index 000000000..5c1bb19f2 --- /dev/null +++ b/services/loopback/common/methods/client/activeSalesPerson.js @@ -0,0 +1,73 @@ +module.exports = Client => { + Client.remoteMethod('activeSalesPerson', { + description: 'Returns actives workers with salesperson role', + accessType: 'READ', + accepts: [{ + arg: 'filter', + type: 'Object', + required: false, + description: 'Filter defining where and paginated data', + http: {source: 'query'} + }], + returns: { + arg: 'data', + type: 'Worker', + root: true + }, + http: { + path: `/activeSalesPerson`, + verb: 'get' + } + }); + + Client.activeSalesPerson = (filter, callback) => { + let skip = filter.skip || 0; + let limit = filter.limit || 10; + let where = getCondition(filter.where, limit, skip); + + let query = + `SELECT em.id, em.firstName, em.name + FROM worker em + JOIN account.user ac ON em.userFk = ac.id + JOIN account.role r ON r.id = ac.role + WHERE ac.active AND r.\`name\` = 'salesPerson' ${where.sql} + ORDER BY em.name ASC + LIMIT ? OFFSET ?`; + + Client.rawSql(query, where.params).then( + response => callback(null, formatSalesPerson(response)), + err => callback(err) + ); + }; + + function getCondition(where, limit, skip) { + let out = { + sql: '', + params: [] + }; + if (where && where.or) { + out.sql = `AND (em.firstName regexp ? OR em.name regexp ?)`; + where.or.forEach(val => { + Object.keys(val).forEach(key => { + out.params.push(val[key].regexp); + }); + }); + } + out.params.push(parseInt(limit, 10)); + out.params.push(parseInt(skip, 10)); + return out; + } + + function formatSalesPerson(response) { + let results = []; + + response.forEach(person => { + results.push({ + id: person.id, + name: `${person.firstName} ${person.name}` + }); + }); + + return results; + } +}; diff --git a/services/client/common/methods/client/addressesPropagateRe.js b/services/loopback/common/methods/client/addressesPropagateRe.js similarity index 100% rename from services/client/common/methods/client/addressesPropagateRe.js rename to services/loopback/common/methods/client/addressesPropagateRe.js diff --git a/services/loopback/common/methods/client/card.js b/services/loopback/common/methods/client/card.js new file mode 100644 index 000000000..14a9f2fed --- /dev/null +++ b/services/loopback/common/methods/client/card.js @@ -0,0 +1,76 @@ +module.exports = function(Self) { + Self.remoteMethod('card', { + description: 'Get client basic data', + accepts: { + arg: 'id', + type: 'number', + required: true, + description: 'The client id', + http: {source: 'path'} + }, + returns: { + arg: 'data', + type: 'Object', + root: true + }, + http: { + verb: 'GET', + path: '/:id/card' + } + }); + + Self.card = function(id, cb) { + let filter = { + where: { + id: id + }, + include: [ + { + relation: 'salesPerson', + scope: { + fields: ['id', 'firstName', 'name'] + } + }, { + relation: 'contactChannel', + scope: { + fields: ['id', 'name'] + } + }, { + relation: 'province', + scope: { + fields: ['id', 'name'] + } + }, { + relation: 'country', + scope: { + fields: ['id', 'country'] + } + }, { + relation: 'payMethod', + scope: { + fields: ['id', 'name'] + } + }, { + relation: 'account', + scope: { + fields: ['id', 'name', 'active'] + } + } + ] + }; + + Self.findOne(filter, function(err, card) { + if (err) return cb(err); + + let formatedCard = JSON.parse(JSON.stringify(card)); + + if (formatedCard.salesPersonFk) + formatedCard.salesPerson = { + id: card.salesPerson().id, + name: `${card.salesPerson().firstName} ${card.salesPerson().name}` + }; + + cb(null, formatedCard); + }); + }; +}; diff --git a/services/client/common/methods/client/create.js b/services/loopback/common/methods/client/createWithUser.js similarity index 63% rename from services/client/common/methods/client/create.js rename to services/loopback/common/methods/client/createWithUser.js index 58e947e3f..2378406b4 100644 --- a/services/client/common/methods/client/create.js +++ b/services/loopback/common/methods/client/createWithUser.js @@ -1,7 +1,7 @@ -var app = require('../../../server/server'); +let md5 = require('md5'); -module.exports = function(Client) { - Client.remoteMethod('createUserProfile', { +module.exports = function(Self) { + Self.remoteMethod('createWithUser', { description: 'Creates both client and its web account', accepts: { arg: 'data', @@ -14,20 +14,23 @@ module.exports = function(Client) { }, http: { verb: 'post', - path: '/createUserProfile' + path: '/createWithUser' } }); - Client.createUserProfile = (data, callback) => { + Self.createWithUser = (data, callback) => { let firstEmail = data.email ? data.email.split(',')[0] : null; let user = { name: data.userName, email: firstEmail, - password: parseInt(Math.random() * 100000000000000) + password: md5(parseInt(Math.random() * 100000000000000)) }; + let Account = Self.app.models.Account; - app.models.Account.beginTransaction('READ COMMITTED', (error, transaction) => { - app.models.Account.create(user, {transaction}, (error, account) => { + Account.beginTransaction({}, (error, transaction) => { + if (error) return callback(error); + + Account.create(user, {transaction}, (error, account) => { if (error) { transaction.rollback(); return callback(error); @@ -38,10 +41,11 @@ module.exports = function(Client) { fi: data.fi, socialName: data.socialName, id: account.id, - email: data.email + email: data.email, + salesPersonFk: data.salesPersonFk }; - Client.create(client, {transaction}, (error, newClient) => { + Self.create(client, {transaction}, (error, newClient) => { if (error) { transaction.rollback(); return callback(error); diff --git a/services/loopback/common/methods/client/filter.js b/services/loopback/common/methods/client/filter.js new file mode 100644 index 000000000..2c79e0556 --- /dev/null +++ b/services/loopback/common/methods/client/filter.js @@ -0,0 +1,60 @@ +module.exports = function(Client) { + Client.installMethod('filter', filterClients); + + function filterClients(params) { + let filters = { + where: {}, + skip: (params.page - 1) * params.size, + limit: params.size + }; + + delete params.page; + delete params.size; + + if (params.search) { + filters.where.and = [ + { + or: [ + {id: params.search}, + {name: {regexp: params.search}} + ] + } + ]; + delete params.search; + } + + if (params.phone) { + let phones = [ + {phone: params.phone}, + {mobile: params.phone} + ]; + if (filters.where.and) { + filters.where.and.push( + { + or: phones + } + ); + } else { + filters.where.or = phones; + } + delete params.phone; + } + + let keys = Object.keys(params); + if (keys.length) { + keys.forEach( + key => { + if (filters.where.and) { + let filter = {}; + filter[key] = (key === 'postcode' || key === 'fi' || key === 'id') ? params[key] : {regexp: params[key]}; + filters.where.and.push(filter); + } else { + filters.where[key] = (key === 'postcode' || key === 'fi' || key === 'id') ? params[key] : {regexp: params[key]}; + } + } + ); + } + + return filters; + } +}; diff --git a/services/loopback/common/methods/client/hasCustomerRole.js b/services/loopback/common/methods/client/hasCustomerRole.js new file mode 100644 index 000000000..561f00b06 --- /dev/null +++ b/services/loopback/common/methods/client/hasCustomerRole.js @@ -0,0 +1,45 @@ +module.exports = Self => { + Self.remoteMethod('hasCustomerRole', { + description: 'Comprueba si un usuario tiene el rol de cliente', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'string', + required: true, + description: 'The user id', + http: {source: 'path'} + }, { + arg: 'context', + type: 'object', + required: true, + description: 'Filter defining where', + http: function(context) { + return context.req.query; + } + } + ], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/:id/hasCustomerRole`, + verb: 'GET' + } + }); + + Self.hasCustomerRole = (id, context, callback) => { + let query = + `SELECT COUNT(*) > 0 isCustomer + FROM salix.Account A + JOIN salix.Role r ON r.id = A.roleFK + WHERE r.name = 'customer' + AND A.id IN (?)`; + + Self.rawSql(query, [id]).then( + instances => callback(null, instances[0]), + err => callback(err) + ); + }; +}; diff --git a/services/client/common/methods/client/addresses.js b/services/loopback/common/methods/client/listAddresses.js similarity index 53% rename from services/client/common/methods/client/addresses.js rename to services/loopback/common/methods/client/listAddresses.js index 247c9aec0..0c93dd1cd 100644 --- a/services/client/common/methods/client/addresses.js +++ b/services/loopback/common/methods/client/listAddresses.js @@ -1,5 +1,5 @@ module.exports = function(Client) { - Client.remoteMethod('addressesList', { + Client.remoteMethod('listAddresses', { description: 'List items using a filter', accessType: 'READ', accepts: [ @@ -26,25 +26,46 @@ module.exports = function(Client) { root: true }, http: { - path: `/:id/addressesList`, - verb: 'get' + path: `/:id/listAddresses`, + verb: 'GET' } }); - Client.addressesList = function(id, params, callback) { + Client.listAddresses = function(id, params, callback) { let filter = { where: { clientFk: id }, skip: (params.page - 1) * params.size, limit: params.size, - order: ['isDefaultAddress DESC', 'isEnabled DESC'] + order: ['isDefaultAddress DESC', 'isActive DESC'], + include: {observations: 'observationType'} }; + let total = null; + let items = null; + + function response(type, value) { + if (type === 'total') { + total = value; + } else { + items = value; + } + + if (total !== null && items !== null) { + callback(null, {total: total, items: items}); + } + } + Client.app.models.Address.find(filter, function(err, instances) { - if (err) - return callback(err, null); - callback(null, instances); + if (err) return callback(err); + response('find', instances); + }); + + Client.app.models.Address.count(filter.where, function(err, total) { + if (err) return callback(err); + response('total', total); }); }; + }; diff --git a/services/loopback/common/methods/client/listWorkers.js b/services/loopback/common/methods/client/listWorkers.js new file mode 100644 index 000000000..92339e32f --- /dev/null +++ b/services/loopback/common/methods/client/listWorkers.js @@ -0,0 +1,30 @@ +module.exports = function(Self) { + Self.remoteMethod('listWorkers', { + description: 'List workers', + accessType: 'READ', + returns: { + arg: 'data', + type: 'Worker', + root: true + }, + http: { + path: `/listWorkers`, + verb: 'GET' + } + }); + + Self.listWorkers = function() { + let query = + `SELECT w.id, + CONCAT(w.firstName, IFNULL(CONCAT(" ", w.name), "")) \`name\` + FROM worker w + JOIN account.user u ON w.userFk = u.id + JOIN account.roleRole rr ON rr.role = u.role + JOIN account.role r ON r.id = rr.inheritsFrom + WHERE u.active + AND r.\`name\` = 'employee' + ORDER BY w.name ASC`; + + return Self.rawSql(query); + }; +}; diff --git a/services/loopback/common/methods/client/specs/activeSalesperson.spec.js b/services/loopback/common/methods/client/specs/activeSalesperson.spec.js new file mode 100644 index 000000000..085c0f3ce --- /dev/null +++ b/services/loopback/common/methods/client/specs/activeSalesperson.spec.js @@ -0,0 +1,33 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; + +describe('Client activeSalesPerson', () => { + it('should call the activeSalesPerson() method with limit of 1', done => { + let filter = { + limit: 1 + }; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result.length).toEqual(1); + done(); + }; + + app.models.Client.activeSalesPerson(filter, callback); + }); + + it('should call the activeSalesPerson() method with no limit and receive all 3 salesPersons', done => { + let filter = { + }; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result.length).toEqual(3); + done(); + }; + + app.models.Client.activeSalesPerson(filter, callback); + }); +}); diff --git a/services/loopback/common/methods/client/specs/addressesPropagateRe.spec.js b/services/loopback/common/methods/client/specs/addressesPropagateRe.spec.js new file mode 100644 index 000000000..5034e3f57 --- /dev/null +++ b/services/loopback/common/methods/client/specs/addressesPropagateRe.spec.js @@ -0,0 +1,83 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; +const restoreFixtures = require('../../../../../../services/db/testing_fixtures'); + +describe('Client addressesPropagateRe', () => { + let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [ + `INSERT INTO account.user(id,name,password,role,active,email) + VALUES + (1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'), + (2, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@verdnatura.es'), + (3, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@verdnatura.es'), + (4, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@verdnatura.es'), + (5, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@verdnatura.es'), + (6, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'DavidCharlesHaller@verdnatura.es'), + (7, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@verdnatura.es'), + (8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'), + (9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'), + (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'), + (11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es'); + + INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated) + VALUES + (1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 0), + (2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0), + (3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0), + (4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0), + (5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0), + (6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0), + (7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0), + (8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0), + (9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0), + (10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0); + + INSERT INTO vn.client(id,name,fi,socialName,contact,street,city,postcode,phone,mobile,fax,isRelevant,email,iban,dueDay,accountingAccount,isEqualizated,provinceFk,hasToInvoice,credit,countryFk,isActive,gestdocFk,quality,payMethodFk,created,isToBeMailed,contactChannelFk,hasSepaVnl,hasCoreVnl,hasCoreVnh,riskCalculated,clientTypeFk,mailAddress,cplusTerIdNifFk,hasToInvoiceByAddress,isTaxDataChecked,isFreezed,creditInsurance,isCreatedAsServed,hasInvoiceSimplified,salesPersonFk,isVies,eypbc) + VALUES + (1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1), + (9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1), + (10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1);` + ]}; + + beforeEach(done => { + restoreFixtures(fixturesToApply, done); + }); + + afterAll(done => { + restoreFixtures(fixturesToApply, done); + }); + + it('should propagate the isEqualizated on both addresses of Mr Wayne', done => { + let id = 1; + let data = { + isEqualizated: true + }; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toBe(true); + app.models.Address.find({where: {clientFk: id}}) + .then(result => { + expect(result[0].isEqualizated).toBeTruthy(); + expect(result[1].isEqualizated).toBeTruthy(); + done(); + }); + }; + app.models.Address.find({where: {clientFk: id}}) + .then(result => { + expect(result[0].isEqualizated).toBeFalsy(); + expect(result[1].isEqualizated).toBeFalsy(); + }) + .then(() => { + app.models.Client.addressesPropagateRe(id, data, callback); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/services/loopback/common/methods/client/specs/card.spec.js b/services/loopback/common/methods/client/specs/card.spec.js new file mode 100644 index 000000000..1d0697f88 --- /dev/null +++ b/services/loopback/common/methods/client/specs/card.spec.js @@ -0,0 +1,20 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; + +describe('Client card', () => { + it('should call the card() method to receive a formated card of Bruce Wayne', done => { + let id = 1; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toEqual(jasmine.objectContaining({ + id: 1, + name: 'Bruce Wayne' + })); + done(); + }; + + app.models.Client.card(id, callback); + }); +}); diff --git a/services/loopback/common/methods/client/specs/createWithUser.spec.js b/services/loopback/common/methods/client/specs/createWithUser.spec.js new file mode 100644 index 000000000..d84ea5c2f --- /dev/null +++ b/services/loopback/common/methods/client/specs/createWithUser.spec.js @@ -0,0 +1,128 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; +const restoreFixtures = require('../../../../../../services/db/testing_fixtures'); + +describe('Client Create', () => { + let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [ + `INSERT INTO account.user(id,name,password,role,active,email) + VALUES + (1, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@verdnatura.es'), + (2, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@verdnatura.es'), + (3, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@verdnatura.es'), + (4, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@verdnatura.es'), + (5, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@verdnatura.es'), + (6, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'DavidCharlesHaller@verdnatura.es'), + (7, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@verdnatura.es'), + (8, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'CharlesXavier@verdnatura.es'), + (9, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 18, 1, 'BruceBanner@verdnatura.es'), + (10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'), + (11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es'); + + INSERT INTO salix.Address(id, consignee, street, city, postcode, provinceFk, phone, mobile, isEnabled, isDefaultAddress, clientFk, defaultAgencyFk, longitude, latitude, isEqualizated) + VALUES + (1, 'Bruce Wayne', 'The Bat cave', 'Silla', 46460, 1, NULL, NULL, 1, 1, 1, 2, NULL, NULL, 0), + (2, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0), + (3, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0), + (4, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0), + (5, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0), + (6, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0), + (7, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0), + (8, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0), + (9, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0), + (10,'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0); + + INSERT INTO vn.client(id,name,fi,socialName,contact,street,city,postcode,phone,mobile,fax,isRelevant,email,iban,dueDay,accountingAccount,isEqualizated,provinceFk,hasToInvoice,credit,countryFk,isActive,gestdocFk,quality,payMethodFk,created,isToBeMailed,contactChannelFk,hasSepaVnl,hasCoreVnl,hasCoreVnh,riskCalculated,clientTypeFk,mailAddress,cplusTerIdNifFk,hasToInvoiceByAddress,isTaxDataChecked,isFreezed,creditInsurance,isCreatedAsServed,hasInvoiceSimplified,salesPersonFk,isVies,eypbc) + VALUES + (1, 'Bruce Wayne', '74451390E', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (2, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (3, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (4, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 1, 0, 1), + (5, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (6, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (7, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 3, 0, 1), + (8, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1), + (9, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1), + (10, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 4, 0, 1);` + ]}; + + beforeEach(done => { + restoreFixtures(fixturesToApply, done); + }); + + afterAll(done => { + restoreFixtures(fixturesToApply, done); + }); + + let newAccountData = { + active: true, + name: 'Wade', + userName: 'Deadpool', + email: 'Deadpool@marvel.com', + fi: 'DP', + socialName: 'Deadpool Marvel', + salesPersonFk: 1 + }; + + it('should find Charles Xavier', done => { + app.models.Account.findOne({where: {name: 'CharlesXavier'}}) + .then(account => { + expect(account.name).toEqual('CharlesXavier'); + done(); + }); + }); + + it(`should not find Deadpool as he's not created yet`, done => { + app.models.Account.findOne({where: {name: newAccountData.userName}}) + .then(account => { + expect(account).toEqual(null); + app.models.Client.findOne({where: {name: newAccountData.name}}) + .then(client => { + expect(client).toEqual(null); + done(); + }); + }) + .catch(catchErrors(done)); + }); + + it('should not be able to create a user if exists', done => { + app.models.Client.findOne({where: {name: 'Charles Xavier'}}) + .then(client => { + app.models.Account.findOne({where: {id: client.id}}) + .then(account => { + let formerAccountData = { + name: client.name, + userName: account.name, + email: client.email, + fi: client.fi, + socialName: client.socialName + }; + + app.models.Client.createWithUser(formerAccountData, (err, client) => { + expect(err.details.codes.name[0]).toEqual('uniqueness'); + done(); + }); + }); + }) + .catch(catchErrors(done)); + }); + + it('should create a new account', done => { + app.models.Client.createWithUser(newAccountData, (error, client) => { + if (error) return catchErrors(done)(error); + app.models.Account.findOne({where: {name: newAccountData.userName}}) + .then(account => { + expect(account.name).toEqual(newAccountData.userName); + app.models.Client.findOne({where: {name: newAccountData.name}}) + .then(client => { + expect(client.id).toEqual(account.id); + expect(client.name).toEqual(newAccountData.name); + expect(client.email).toEqual(newAccountData.email); + expect(client.fi).toEqual(newAccountData.fi); + expect(client.socialName).toEqual(newAccountData.socialName); + done(); + }); + }) + .catch(catchErrors(done)); + }); + }); +}); diff --git a/services/loopback/common/methods/client/specs/hasCustomerRole.spec.js b/services/loopback/common/methods/client/specs/hasCustomerRole.spec.js new file mode 100644 index 000000000..32773e25e --- /dev/null +++ b/services/loopback/common/methods/client/specs/hasCustomerRole.spec.js @@ -0,0 +1,60 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; + +describe('Client hasCustomerRole', () => { + it('should call the hasCustomerRole() method with a customer id', done => { + let id = 1; + let params = {}; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toEqual(jasmine.objectContaining({isCustomer: 1})); + done(); + }; + + app.models.Client.hasCustomerRole(id, params, callback); + }); + + it('should call the hasCustomerRole() method with a non customer id', done => { + let id = 8; + let params = {}; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toEqual(jasmine.objectContaining({isCustomer: 0})); + done(); + }; + + app.models.Client.hasCustomerRole(id, params, callback); + }); + + it('should call the hasCustomerRole() method with an unreal id', done => { + let id = 999; + let params = {}; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toEqual(jasmine.objectContaining({isCustomer: 0})); + done(); + }; + + app.models.Client.hasCustomerRole(id, params, callback); + }); + + it('should call the hasCustomerRole() method with an invalid id', done => { + let id = 'WRONG!'; + let params = {}; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(result).toEqual(jasmine.objectContaining({isCustomer: 0})); + done(); + }; + + app.models.Client.hasCustomerRole(id, params, callback); + }); +}); diff --git a/services/loopback/common/methods/client/specs/listAddresses.spec.js b/services/loopback/common/methods/client/specs/listAddresses.spec.js new file mode 100644 index 000000000..0369d4bb0 --- /dev/null +++ b/services/loopback/common/methods/client/specs/listAddresses.spec.js @@ -0,0 +1,20 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers'); + +describe('Client addresses', () => { + it('should call the listAddresses method and receive total results and items', done => { + let id = 1; + let params = { + page: 1, + size: 1 + }; + + let callback = (error, result) => { + if (error) return catchErrors(done)(error); + + expect(Object.keys(result)).toEqual(['total', 'items']); + done(); + }; + app.models.Client.listAddresses(id, params, callback); + }); +}); diff --git a/services/loopback/common/methods/client/specs/listWorkers.spec.js b/services/loopback/common/methods/client/specs/listWorkers.spec.js new file mode 100644 index 000000000..823cb6db1 --- /dev/null +++ b/services/loopback/common/methods/client/specs/listWorkers.spec.js @@ -0,0 +1,15 @@ +const app = require('../../../../../client/server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; + +describe('Client listWorkers', () => { + it('should call the listWorkers()', done => { + app.models.Client.listWorkers() + .then(result => { + let amountOfEmployees = Object.keys(result).length; + + expect(amountOfEmployees).toEqual(6); + done(); + }) + .catch(catchErrors(done)); + }); +}); diff --git a/services/loopback/common/methods/warehouse/list.js b/services/loopback/common/methods/warehouse/list.js deleted file mode 100644 index 591ea68f7..000000000 --- a/services/loopback/common/methods/warehouse/list.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function(Self) { - Self.defineScope({where: {isManaged: {neq: 0}}}); -}; diff --git a/services/loopback/common/models/account.json b/services/loopback/common/models/account.json index c0f1eb926..feb90fa7f 100644 --- a/services/loopback/common/models/account.json +++ b/services/loopback/common/models/account.json @@ -1,6 +1,11 @@ { "name": "Account", "base": "VnModel", + "options": { + "mysql": { + "table": "user" + } + }, "properties": { "id": { "type": "number", diff --git a/services/loopback/common/models/address.js b/services/loopback/common/models/address.js new file mode 100644 index 000000000..04a4ef80b --- /dev/null +++ b/services/loopback/common/models/address.js @@ -0,0 +1,49 @@ +var UserError = require('../helpers').UserError; +var getFinalState = require('../helpers').getFinalState; +var isMultiple = require('../helpers').isMultiple; + +module.exports = function(Self) { + Self.validate('isDefaultAddress', isActive, + {message: 'Unable to default a disabled consignee'} + ); + function isActive(err) { + if (!this.isActive && this.isDefaultAddress) err(); + } + + Self.beforeRemote('findById', function(ctx, modelInstance, next) { + ctx.args.filter = { + include: [{ + relation: 'province', + scope: { + fields: ['id', 'name'] + } + }, { + relation: 'agency', + scope: { + fields: ['id', 'name'] + } + }] + }; + next(); + }); + + // Helpers + + Self.observe('before save', async function(ctx) { + if (isMultiple(ctx)) return; + + let changes = ctx.data || ctx.instance; + let finalState = getFinalState(ctx); + + if (changes.isActive == false && finalState.isDefaultAddress) + throw new UserError('The default consignee can not be unchecked'); + + if (changes.isDefaultAddress == true && finalState.isActive != false) { + let filter = { + clientFk: finalState.clientFk, + isDefaultAddress: {neq: false} + }; + await Self.updateAll(filter, {isDefaultAddress: false}); + } + }); +}; diff --git a/services/client/common/models/address.json b/services/loopback/common/models/address.json similarity index 75% rename from services/client/common/models/address.json rename to services/loopback/common/models/address.json index 937073d16..14fa15593 100644 --- a/services/client/common/models/address.json +++ b/services/loopback/common/models/address.json @@ -1,13 +1,19 @@ { "name": "Address", + "description": "Client addresses", "base": "VnModel", + "options": { + "mysql": { + "table": "address" + } + }, "properties": { "id": { "type": "Number", "id": true, "description": "Identifier" }, - "consignee": { + "nickname": { "type": "string", "required": true }, @@ -19,7 +25,7 @@ "type": "string", "required": true }, - "postcode": { + "postalCode": { "type": "string" }, "phone": { @@ -28,7 +34,7 @@ "mobile": { "type": "string" }, - "isEnabled": { + "isActive": { "type": "boolean" }, "isDefaultAddress": { @@ -56,10 +62,15 @@ "model": "Client", "foreignKey": "clientFk" }, - "defaultAgency": { + "agency": { "type": "belongsTo", "model": "AgencyMode", - "foreignKey": "defaultAgencyFk" + "foreignKey": "agencyFk" + }, + "observations": { + "type": "hasMany", + "model": "AddressObservation", + "foreignKey": "addressFk" } } } diff --git a/services/loopback/common/models/agency.js b/services/loopback/common/models/agency.js index 0d5c3dd8c..591ea68f7 100644 --- a/services/loopback/common/models/agency.js +++ b/services/loopback/common/models/agency.js @@ -1,3 +1,3 @@ module.exports = function(Self) { - require('../methods/agency/list.js')(Self); + Self.defineScope({where: {isManaged: {neq: 0}}}); }; diff --git a/services/loopback/common/models/agency.json b/services/loopback/common/models/agency.json index 25a1d053a..9269b3db6 100644 --- a/services/loopback/common/models/agency.json +++ b/services/loopback/common/models/agency.json @@ -1,6 +1,11 @@ { "name": "Agency", "base": "VnModel", + "options": { + "mysql": { + "table": "agency" + } + }, "properties": { "id": { "id": true, diff --git a/services/client/common/models/client-credit-limit.json b/services/loopback/common/models/client-credit-limit.json similarity index 81% rename from services/client/common/models/client-credit-limit.json rename to services/loopback/common/models/client-credit-limit.json index eb5872c7b..5263fb94b 100644 --- a/services/client/common/models/client-credit-limit.json +++ b/services/loopback/common/models/client-credit-limit.json @@ -1,6 +1,11 @@ { "name": "ClientCreditLimit", "base": "VnModel", + "options": { + "mysql": { + "table": "clientCreditLimit" + } + }, "properties": { "id": { "type": "Number", diff --git a/services/loopback/common/models/client.js b/services/loopback/common/models/client.js new file mode 100644 index 000000000..2b21ccfa3 --- /dev/null +++ b/services/loopback/common/models/client.js @@ -0,0 +1,160 @@ +var UserError = require('../helpers').UserError; +var getFinalState = require('../helpers').getFinalState; +var isMultiple = require('../helpers').isMultiple; + +module.exports = function(Self) { + // Methods + + require('../methods/client/activate')(Self); + require('../methods/client/listAddresses')(Self); + require('../methods/client/card')(Self); + require('../methods/client/createWithUser')(Self); + require('../methods/client/listWorkers')(Self); + require('../methods/client/filter')(Self); + require('../methods/client/hasCustomerRole')(Self); + require('../methods/client/activeSalesPerson')(Self); + require('../methods/client/addressesPropagateRe')(Self); + + // Validations + + Self.validatesUniquenessOf('fi', { + message: 'El NIF/CIF debe ser único' + }); + Self.validatesUniquenessOf('socialName', { + message: 'La razón social debe ser única' + }); + Self.validatesFormatOf('postcode', { + message: 'El código postal solo debe contener números', + allowNull: true, + allowBlank: true, + with: /^\d+$/ + }); + Self.validatesFormatOf('email', { + message: 'Correo electrónico inválido', + allowNull: true, + allowBlank: true, + with: /^[\w|.|-]+@\w[\w|.|-]*\w(,[\w|.|-]+@\w[\w|.|-]*\w)*$/ + }); + Self.validatesLengthOf('postcode', { + allowNull: true, + allowBlank: true, + min: 3, max: 10 + }); + + var validateIban = require('../validations/validateIban'); + Self.validateBinded('iban', validateIban, { + message: 'El iban no tiene el formato correcto' + }); + + let validateDni = require('../validations/validateDni'); + Self.validateBinded('fi', validateDni, { + message: 'DNI Incorrecto' + }); + + Self.validate('payMethod', hasSalesMan, { + message: 'No se puede cambiar la forma de pago si no hay comercial asignado' + }); + function hasSalesMan(err) { + if (this.payMethod && !this.salesPerson) + err(); + } + + Self.validateAsync('payMethodFk', hasIban, { + message: 'El método de pago seleccionado requiere que se especifique el IBAN' + }); + function hasIban(err, done) { + Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => { + if (instance && instance.ibanRequired && !this.iban) + err(); + done(); + }); + } + + // Hooks + + Self.observe('before save', async function(ctx) { + let changes = ctx.data || ctx.instance; + let finalState = getFinalState(ctx); + + if (changes.salesPerson === null) { + changes.credit = 0; + changes.discount = 0; + changes.payMethodFk = 5; // Credit card + } + + if (changes.payMethodFk !== undefined && changes.dueDay === undefined) + changes.dueDay = 5; + + if (isMultiple(ctx)) return; + + if (changes.isEqualizated || changes.fi !== undefined) { + let fiLetter = finalState.fi && finalState.fi.toUpperCase().charAt(0); + let canMarkEqualizationTax = fiLetter != 'A' && fiLetter != 'B'; + + if (finalState.isEqualizated && !canMarkEqualizationTax) + throw new UserError('Unable to mark the equivalence surcharge'); + } + + if (changes.credit !== undefined) + try { + await validateCreditChange(ctx, finalState); + } catch (e) { + throw new UserError('You are not allowed to change the credit'); + } + }); + + async function validateCreditChange(ctx, finalState) { + let models = Self.app.models; + let userId = ctx.options.accessToken.userId; + let filter = { + fields: ['roleFk'], + where: { + maxAmount: {gt: ctx.data.credit} + } + }; + + let limits = await models.ClientCreditLimit.find(filter); + + if (limits.length == 0) + throw new Error('Credit limits not found'); + + // Si el usuario no tiene alguno de los roles no continua + + let requiredRoles = []; + for (limit of limits) + requiredRoles.push(limit.roleFk); + + let where = { + roleId: {inq: requiredRoles}, + principalType: 'USER', + principalId: userId + }; + let count = await models.RoleMapping.count(where); + + if (count <= 0) + throw new Error('The role cannot set this credit amount'); + + // Si se puso a 0 por gerencia, solo gerencia puede aumentarlo + + let query = 'SELECT * FROM clientCredit WHERE clientFk = ? ORDER BY created DESC LIMIT 1'; + let instances = await Self.rawSql(query, [finalState.id]); + + if (instances.length !== 1 || instances[0].workerFk == userId || instances[0].amount > 0) + return; + + query = `SELECT COUNT(distinct r.id) > 0 as hasManagerRole + FROM clientCredit cc + JOIN worker em ON em.id = cc.workerFk + JOIN account.user ac ON ac.id = em.userFk + JOIN salix.RoleMapping rm ON rm.principalId = ac.id + JOIN account.role r on r.id = rm.roleId + WHERE rm.principalType = 'USER' + AND cc.workerFk = ? + AND r.name = 'manager'`; + + let instance = await Self.rawSql(query, [instances[0].workerFk]); + + if (instance[0].hasManagerRole > 0) + throw new Error('Only manager can change the credit'); + } +}; diff --git a/services/client/common/models/client.json b/services/loopback/common/models/client.json similarity index 88% rename from services/client/common/models/client.json rename to services/loopback/common/models/client.json index 3ef9b48f2..b16f24f91 100644 --- a/services/client/common/models/client.json +++ b/services/loopback/common/models/client.json @@ -1,6 +1,11 @@ { "name": "Client", "base": "VnModel", + "options": { + "mysql": { + "table": "client" + } + }, "properties": { "id": { "type": "Number", @@ -16,7 +21,8 @@ "description": "Fiscal indentifier" }, "socialName": { - "type": "string" + "type": "string", + "required": true }, "contact": { "type": "string" @@ -39,15 +45,9 @@ "mobile": { "type": "string" }, - "fax": { - "type": "string" - }, - "active": { + "isActive": { "type": "boolean" }, - "discount":{ - "type": "Number" - }, "credit": { "type": "Number" }, @@ -60,7 +60,7 @@ "dueDay": { "type": "Number" }, - "equalizationTax": { + "isEqualizated": { "type": "boolean", "description": "The client has equalization tax" }, @@ -72,17 +72,20 @@ "type": "boolean", "description": "Global invoicing enabled for the client" }, - "invoiceByEmail": { + "isToBeMailed": { "type": "boolean", "description": "Send invoices by email" }, - "sepaVnl": { + "hasSepaVnl": { "type": "boolean" }, - "coreVnl": { + "hasCoreVnl": { "type": "boolean" }, - "coreVnh": { + "hasCoreVnh": { + "type": "boolean" + }, + "isTaxDataChecked":{ "type": "boolean" }, "eypbc": { @@ -91,7 +94,7 @@ "quality": { "type": "Number" }, - "vies": { + "isVies": { "type": "boolean" }, "isRelevant": { @@ -117,7 +120,7 @@ }, "salesPerson": { "type": "belongsTo", - "model": "Employee", + "model": "Worker", "foreignKey": "salesPersonFk" }, "province":{ diff --git a/services/client/common/models/contact-channel.json b/services/loopback/common/models/contact-channel.json similarity index 76% rename from services/client/common/models/contact-channel.json rename to services/loopback/common/models/contact-channel.json index b60367074..3a5de2140 100644 --- a/services/client/common/models/contact-channel.json +++ b/services/loopback/common/models/contact-channel.json @@ -1,6 +1,11 @@ { "name": "ContactChannel", "base": "VnModel", + "options": { + "mysql": { + "table": "contactChannel" + } + }, "properties": { "id": { "type": "Number", diff --git a/services/loopback/common/models/country.json b/services/loopback/common/models/country.json index 3a1d26c5f..c9523e8a3 100644 --- a/services/loopback/common/models/country.json +++ b/services/loopback/common/models/country.json @@ -1,19 +1,22 @@ { "name": "Country", + "description": "Worldwide countries", "base": "VnModel", + "options": { + "mysql": { + "table": "country" + } + }, "properties": { "id": { "type": "Number", "id": true, "description": "Identifier" }, - "name": { + "country": { "type": "string", "required": true }, - "inCee": { - "type": "Number" - }, "code": { "type": "string" } @@ -23,11 +26,6 @@ "type": "belongsTo", "model": "Currency", "foreignKey": "currencyFk" - }, - "realCountry": { - "type": "belongsTo", - "model": "Country", - "foreignKey": "realCountryFk" } }, "acls": [ diff --git a/services/client/common/models/credit-classification.json b/services/loopback/common/models/credit-classification.json similarity index 76% rename from services/client/common/models/credit-classification.json rename to services/loopback/common/models/credit-classification.json index 88f6b74df..685ca00cf 100644 --- a/services/client/common/models/credit-classification.json +++ b/services/loopback/common/models/credit-classification.json @@ -1,7 +1,12 @@ { "name": "CreditClassification", - "description": "Clientes clasificados.", + "description": "Clasified clients", "base": "VnModel", + "options": { + "mysql": { + "table": "creditClassification" + } + }, "properties": { "id": { "id": true, diff --git a/services/client/common/models/pay-method.json b/services/loopback/common/models/pay-method.json similarity index 85% rename from services/client/common/models/pay-method.json rename to services/loopback/common/models/pay-method.json index ab63ef086..ceb08bfbe 100644 --- a/services/client/common/models/pay-method.json +++ b/services/loopback/common/models/pay-method.json @@ -1,6 +1,11 @@ { "name": "PayMethod", "base": "VnModel", + "options": { + "mysql": { + "table": "payMethod" + } + }, "properties": { "id": { "type": "Number", diff --git a/services/loopback/common/models/province.json b/services/loopback/common/models/province.json index e33b61e91..49a971b65 100644 --- a/services/loopback/common/models/province.json +++ b/services/loopback/common/models/province.json @@ -1,6 +1,12 @@ { "name": "Province", + "description": "Provinces of every country", "base": "VnModel", + "options": { + "mysql": { + "table": "province" + } + }, "properties": { "id": { "type": "Number", diff --git a/services/loopback/common/models/vn-model.js b/services/loopback/common/models/vn-model.js index 3305cb67d..60bc02724 100644 --- a/services/loopback/common/models/vn-model.js +++ b/services/loopback/common/models/vn-model.js @@ -86,9 +86,9 @@ module.exports = function(Self) { var connector = this.dataSource.connector; return new Promise(function(resolve, reject) { connector.execute(query, params, function(error, response) { - if (error && !reject) - cb(error, null); - else if (error && reject) + if (cb) + cb(error, response); + if (error) reject(error); else resolve(response); @@ -125,12 +125,12 @@ module.exports = function(Self) { Self.disconnectFromService = function(dataSource) { this.app.dataSources[dataSource].connector.remotes.auth = { - bearer: new Buffer("").toString('base64'), + bearer: new Buffer('').toString('base64'), sendImmediately: true }; }; - Self.installMethod = function(methodName, filterCb) { + Self.installMethod = function(methodName, filterCb, filterResult) { this.remoteMethod(methodName, { description: 'List items using a filter', accessType: 'READ', @@ -158,11 +158,16 @@ module.exports = function(Self) { this[methodName] = (params, cb) => { let filter = removeEmpty(filterCb(params)); + var response = {}; function returnValues() { - if (response.instances !== undefined && response.count !== undefined) - cb(null, response); + if (response.instances !== undefined && response.count !== undefined) { + if (filterResult) + cb(null, filterResult(response)); + else + cb(null, response); + } } function error() { @@ -177,6 +182,7 @@ module.exports = function(Self) { returnValues(); } }); + this.count(filter.where, function(err, totalCount) { if (err) { error(); @@ -223,6 +229,5 @@ function removeEmpty(o) { } function isEmpty(value) { - return value === undefined || value === ""; + return value === undefined || value === ''; } - diff --git a/services/loopback/common/models/warehouse.js b/services/loopback/common/models/warehouse.js index a4c8abc0a..6e700913b 100644 --- a/services/loopback/common/models/warehouse.js +++ b/services/loopback/common/models/warehouse.js @@ -1,4 +1,4 @@ module.exports = function(Self) { - require('../methods/warehouse/list.js')(Self); + Self.defineScope({where: {isManaged: {neq: 0}}}); }; diff --git a/services/loopback/common/models/warehouse.json b/services/loopback/common/models/warehouse.json index 806c07b40..7b6fef1cd 100644 --- a/services/loopback/common/models/warehouse.json +++ b/services/loopback/common/models/warehouse.json @@ -1,6 +1,12 @@ { "name": "Warehouse", + "description": "Warehouses from where orders are sent", "base": "VnModel", + "options": { + "mysql": { + "table": "warehouse" + } + }, "properties": { "id": { "id": true, @@ -10,7 +16,7 @@ "name": { "type": "String" }, - "inventory": { + "isInventory": { "type": "Number" }, "isManaged":{ diff --git a/services/loopback/common/models/employee.json b/services/loopback/common/models/worker.json similarity index 72% rename from services/loopback/common/models/employee.json rename to services/loopback/common/models/worker.json index c88f889ef..f8399be8d 100644 --- a/services/loopback/common/models/employee.json +++ b/services/loopback/common/models/worker.json @@ -1,17 +1,23 @@ { - "name": "Employee", + "name": "Worker", + "description": "Company employees", "base": "VnModel", + "options": { + "mysql": { + "table": "worker" + } + }, "properties": { "id": { "type": "Number", "id": true, "description": "Identifier" }, - "name": { + "firstName": { "type": "string", "required": true }, - "surname": { + "name": { "type": "string", "required": true } diff --git a/services/loopback/common/validations/validateDni.js b/services/loopback/common/validations/validateDni.js new file mode 100644 index 000000000..242746ae9 --- /dev/null +++ b/services/loopback/common/validations/validateDni.js @@ -0,0 +1,94 @@ +module.exports = fi => { + if (fi === undefined || fi === null) { + return true; + } + let dni = fi; + let getLetterDni = dni => { + const regExpDni = 'TRWAGMYFPDXBNJZSQVHLCKE'; + const letterDni = dni.toUpperCase().substring(0, 1); + let positionLetter = parseInt(dni) % 23; + let getLetter = regExpDni.substring(positionLetter + 1, positionLetter); + switch (letterDni) { + case 'X': case 'Y': case 'Z': + positionLetter = parseInt(dni.replace(letterDni, letterDni.charCodeAt(0) - 88)) % 23; + getLetter = regExpDni.substring(positionLetter + 1, positionLetter); + } + return getLetter; + }; + + let getDniSpain = (dniNumeric, dniLetter) => { + let returnValue = false; + switch (dni.length) { + case 9: + if (dniLetter === getLetterDni(dni)) + returnValue = true; + } + return returnValue; + }; + + let getDniForeign = (dniNumeric, dniLetter) => { + let returnValue = false; + switch (dni.length) { + case 9: + if (dniLetter === getLetterDni(dni)) + returnValue = true; + } + return returnValue; + }; + + let getDniBusiness = () => { + if (dni.length == 9) + return true; + return false; + }; + + let getDniFrance = dniLetterCountry => { + let returnValue = false; + switch (dni.length) { + case 13: + if (dniLetter === 'R') + returnValue = true; + } + return returnValue; + }; + + let getDniItaly = dniLetterCountry => { + let returnValue = false; + switch (dni.length) { + case 13: + if (dniLetter === 'T') + returnValue = true; + } + return returnValue; + }; + + let getDni = () => { + const dniNumeric = dni.substring(0, 8); + const dniLetter = dni.substring(8, 9); + const dniLetterCountry = dni.substring(0, 1); + const dniLetterAscii = parseInt(dniLetterCountry.charCodeAt(0)); + let dniValue = false; + switch (true) { + case (dniLetterAscii >= 88 && dniLetterAscii <= 90): // X-Z + dniValue = getDniForeign(dniNumeric, dniLetter); + break; + case (dniLetterAscii === 66): // B + dniValue = getDniBusiness(); + break; + case (dniLetterAscii === 70): // F + dniValue = getDniFrance(dniLetterCountry); + break; + case (dniLetterAscii === 73): // I + dniValue = getDniItaly(dniLetterCountry); + break; + case (dniLetterAscii >= 48 && dniLetterAscii <= 57): // 0- 9 + dniValue = getDniSpain(dniNumeric, dniLetter); + break; + default: + dniValue = true; + } + return dniValue; + }; + + return getDni(); +}; diff --git a/services/client/common/validations/validateIban.js b/services/loopback/common/validations/validateIban.js similarity index 100% rename from services/client/common/validations/validateIban.js rename to services/loopback/common/validations/validateIban.js diff --git a/services/loopback/favicon.ico b/services/loopback/favicon.ico index affd413f8..0de7b90c9 100644 Binary files a/services/loopback/favicon.ico and b/services/loopback/favicon.ico differ diff --git a/services/loopback/package.json b/services/loopback/package.json index 468786a84..40637ceb0 100644 --- a/services/loopback/package.json +++ b/services/loopback/package.json @@ -2,8 +2,7 @@ "name": "vn-loopback", "version": "1.0.0", "scripts": { - "start": "node .", - "posttest": "npm run lint && nsp check" + "start": "node ." }, "dependencies": { "compression": "^1.0.3", diff --git a/services/loopback/server/boot/validations.js b/services/loopback/server/boot/validations.js index 06a8a8c0b..fe5e5d365 100644 --- a/services/loopback/server/boot/validations.js +++ b/services/loopback/server/boot/validations.js @@ -36,7 +36,7 @@ module.exports = function(app) { for (let validation of validations[fieldName]) { let options = validation.options; - if ((options && options.async) || + if ((options && options.async) || (validation.validation == 'custom' && !validation.isExportable)) continue; diff --git a/services/loopback/server/config.json b/services/loopback/server/config.json index 4fa37a539..d06a355e4 100644 --- a/services/loopback/server/config.json +++ b/services/loopback/server/config.json @@ -8,7 +8,8 @@ "context": false, "rest": { "normalizeHttpPath": false, - "xml": false + "xml": false, + "handleErrors": false }, "json": { "strict": false, diff --git a/services/loopback/server/datasources.json b/services/loopback/server/datasources.json index 74b5ba64d..2752ca7b7 100644 --- a/services/loopback/server/datasources.json +++ b/services/loopback/server/datasources.json @@ -1,12 +1,42 @@ { "db": { "name": "db", - "connector": "memory", - "file": "db.json" + "connector": "memory" }, - "client": { - "name": "client", - "connector": "remote", - "url": "http://localhost:3002/api" + "vn": { + "name": "mysql", + "connector": "mysql", + "database": "vn", + "debug": false, + "host": "localhost", + "port": 3306, + "username": "root", + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 + }, + "salix": { + "name": "mysql", + "connector": "mysql", + "database": "salix", + "debug": false, + "host": "localhost", + "port": 3306, + "username": "root", + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 + }, + "account": { + "name": "mysql", + "connector": "mysql", + "database": "account", + "debug": false, + "host": "localhost", + "port": 3306, + "username": "root", + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/loopback/server/datasources.test.json b/services/loopback/server/datasources.test.json deleted file mode 100644 index 1e2cbf428..000000000 --- a/services/loopback/server/datasources.test.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "db": - { - "name": "db", - "connector": "memory", - "file": "db.json" - }, - "auth": - { - "name": "mysql", - "connector": "mysql", - "database": "salix", - "debug": false, - "host": "localhost", - "port": 3306, - "username": "root", - "password": "" - }, - "vn": { - "name": "mysql", - "connector": "mysql", - "database": "salix", - "debug": false, - "host": "localhost", - "port": 3306, - "username": "root", - "password": "", - "connectTimeout": 20000, - "acquireTimeout": 20000 - }, - "client": { - "name": "client", - "connector": "remote", - "url": "http://localhost:3002/api" - } -} - diff --git a/services/loopback/server/middleware.json b/services/loopback/server/middleware.json index 151b6a0e0..f502a94e2 100644 --- a/services/loopback/server/middleware.json +++ b/services/loopback/server/middleware.json @@ -42,7 +42,7 @@ "loopback#token": {} }, "auth:after": { - "./middleware/currentUser": {} + "./middleware/current-user": {} }, "parse": { "body-parser#json":{} @@ -59,6 +59,7 @@ "loopback#urlNotFound": {} }, "final:after": { + "./middleware/error-handler": {}, "strong-error-handler": {} } } diff --git a/services/loopback/server/middleware/cors.js b/services/loopback/server/middleware/cors.js index 797775e77..73c0d6832 100644 --- a/services/loopback/server/middleware/cors.js +++ b/services/loopback/server/middleware/cors.js @@ -1,13 +1,5 @@ var cors = require('cors'); -var whitelist = ['http://localhost:8080']; -var corsOptions = { - origin: function(origin, callback) { - var originIsWhitelisted = whitelist.indexOf(origin) !== -1; - callback(originIsWhitelisted ? null : 'Bad Request', originIsWhitelisted); - } -}; - module.exports = function() { return cors({origin: true}); }; diff --git a/services/loopback/server/middleware/currentUser.js b/services/loopback/server/middleware/current-user.js similarity index 77% rename from services/loopback/server/middleware/currentUser.js rename to services/loopback/server/middleware/current-user.js index ce604a934..e19cb2778 100644 --- a/services/loopback/server/middleware/currentUser.js +++ b/services/loopback/server/middleware/current-user.js @@ -1,8 +1,7 @@ module.exports = function(options) { - return function storeCurrentUser(req, res, next) { - if (!req.accessToken) { + return function(req, res, next) { + if (!req.accessToken) return next(); - } let LoopBackContext = require('loopback-context'); let loopbackContext = LoopBackContext.getCurrentContext(); diff --git a/services/loopback/server/middleware/datetime.js b/services/loopback/server/middleware/datetime.js deleted file mode 100644 index 7b2e6060d..000000000 --- a/services/loopback/server/middleware/datetime.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = function() { - console.log('Date time middleware triggered.'); - res.json({datetime: new Date()}); -}; diff --git a/services/loopback/server/middleware/error-handler.js b/services/loopback/server/middleware/error-handler.js new file mode 100644 index 000000000..6565ca67a --- /dev/null +++ b/services/loopback/server/middleware/error-handler.js @@ -0,0 +1,28 @@ +const UserError = require('../../common/helpers').UserError; + +module.exports = function() { + return function(err, req, res, next) { + // Thrown user errors + if (err instanceof UserError) { + err.message = req.__(err.message); + return next(err); + } + + // Validation errors + if (err.statusCode == 422) { + try { + let code; + let messages = err.details.messages; + for (code in messages) break; + err.message = req.__(messages[code][0]); + return next(err); + } catch (e) {} + } + + // MySQL user-defined exceptions + if (err.sqlState == '45000') + return next(new UserError(req.__(err.sqlMessage))); + + next(err); + }; +}; diff --git a/services/loopback/server/model-config.json b/services/loopback/server/model-config.json index b89b94371..3a7aa2d22 100644 --- a/services/loopback/server/model-config.json +++ b/services/loopback/server/model-config.json @@ -1,23 +1,9 @@ { - "_meta": { - "sources": [ - "loopback/common/models", - "loopback/server/models", - "../common/models", - "./models" - ], - "mixins": [ - "loopback/common/mixins", - "loopback/server/mixins", - "../common/mixins", - "./mixins" - ] - }, "user": { - "dataSource": "auth" + "dataSource": "salix" }, "AccessToken": { - "dataSource": "auth", + "dataSource": "salix", "relations": { "user": { "type": "belongsTo", @@ -27,15 +13,48 @@ } }, "ACL": { - "dataSource": "auth" + "dataSource": "salix" }, "RoleMapping": { - "dataSource": "auth" + "dataSource": "salix" }, "Role": { - "dataSource": "auth" + "dataSource": "salix" }, "Account": { - "dataSource": "auth" + "dataSource": "account" + }, + "Address": { + "dataSource": "vn" + }, + "Agency": { + "dataSource": "vn" + }, + "Client": { + "dataSource": "vn" + }, + "ClientCreditLimit": { + "dataSource": "vn" + }, + "ContactChannel": { + "dataSource": "vn" + }, + "Country": { + "dataSource": "vn" + }, + "CreditClassification": { + "dataSource": "vn" + }, + "PayMethod": { + "dataSource": "vn" + }, + "Province": { + "dataSource": "vn" + }, + "Warehouse":{ + "dataSource": "vn" + }, + "Worker": { + "dataSource": "vn" } } diff --git a/services/loopback/server/server.js b/services/loopback/server/server.js index 431ca8775..accb971e6 100644 --- a/services/loopback/server/server.js +++ b/services/loopback/server/server.js @@ -1,35 +1,32 @@ -var loopback = require('loopback'); -var boot = require('loopback-boot'); -var path = require('path'); -var fs = require('fs'); -var i18n = require('i18n'); +let loopback = require('loopback'); +let boot = require('loopback-boot'); +let path = require('path'); +let fs = require('fs'); +let i18n = require('i18n'); module.exports = { loopback: loopback, boot: vnBoot }; -function vnBoot(app, rootDir, cb) { +function vnBoot(app, rootDir, rootModule) { // Internationalization - let i18nDir = rootDir + '/i18n'; + let localeDir = `${__dirname}/../common/locale`; - if (fs.existsSync(i18nDir)) { + if (fs.existsSync(localeDir)) { i18n.configure({ - directory: i18nDir, + directory: localeDir, defaultLocale: 'es' }); - app.get('/prueba', function(req, res) { - i18n.setLocale(req.get('Accept-Language').substring(0,2)); - res.send(i18n.__('Hello')); - }); + app.use(i18n.init); } // View - let viewDir = path.join(rootDir, '../client'); + let viewDir = `${rootDir}/../client`; if (fs.existsSync(viewDir)) { app.set('view engine', 'ejs'); @@ -42,52 +39,60 @@ function vnBoot(app, rootDir, cb) { let packageJson = require(rootDir + '/../package.json'); let appName = packageJson.name; - app.start = function() { - return app.listen(function() { + app.start = function(port) { + function onListen() { app.emit('started'); - var baseUrl = app.get('url').replace(/\/$/, ''); + let baseUrl = app.get('url').replace(/\/$/, ''); console.log(`Web server ${appName} listening at: %s`, baseUrl); - }); + } + + let args = port ? [port, onListen] : [onListen]; + return app.listen.apply(app, args); }; let config = require('./config.json'); - for (var key in config) { + for (let key in config) { app.set(key, config[key]); } - var bootOptions = { + let modelConfigFiles = [ + `${__dirname}/model-config.json`, + `${rootDir}/model-config.json` + ]; + + let modelConfig = {}; + + for (file of modelConfigFiles) + if (fs.existsSync(file)) + Object.assign(modelConfig, require(file)); + + let bootOptions = { appRootDir: __dirname, appConfigRootDir: rootDir, modelsRootDir: rootDir, + models: modelConfig, modelSources: [ - "loopback/common/models", - "loopback/server/models", - __dirname + "/../common/models", - __dirname + "/models", - rootDir + "/../common/models", - rootDir + "/models" + `loopback/common/models`, + `loopback/server/models`, + `${__dirname}/../common/models`, + `${rootDir}/../common/models` ], mixinDirs: [ - "loopback/common/mixins", - "loopback/server/mixins", - __dirname + "/../common/mixins", - __dirname + "/mixins", - rootDir + "/../common/mixins", - rootDir + "/mixins" + `loopback/common/mixins`, + `loopback/server/mixins`, + `${__dirname}/../common/mixins`, + `${rootDir}/../common/mixins` ], bootDirs: [ - __dirname + "/boot", - rootDir + "/boot" + `${__dirname}/boot`, + `${rootDir}/boot` ] }; boot(app, bootOptions, function(err) { if (err) throw err; - if (require.main === module) { + if (require.main === rootModule) app.start(); - } - if (cb) - cb(app); }); } diff --git a/services/mailer/.gitignore b/services/mailer/.gitignore index 69d30d5cc..3c3629e64 100644 --- a/services/mailer/.gitignore +++ b/services/mailer/.gitignore @@ -1,5 +1 @@ node_modules -config.json -app.development.json -smtp.development.json -mysql.development.json diff --git a/services/mailer/Dockerfile b/services/mailer/Dockerfile deleted file mode 100644 index 9c1503ee2..000000000 --- a/services/mailer/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:6.9.1 - -COPY . /app - -WORKDIR /app - -RUN npm install - -RUN npm -g install pm2 - -CMD ["pm2-docker", "./server/server.js"] - -EXPOSE 3003 diff --git a/services/mailer/application/auth.js b/services/mailer/application/auth.js index ee8f114e1..49918eb57 100644 --- a/services/mailer/application/auth.js +++ b/services/mailer/application/auth.js @@ -1,13 +1,13 @@ var database = require('./database.js'); +let config = require('./config.js'); module.exports = { - -/** - * Initialize auth - * @param {Object} request - Request object - * @param {Object} response - Response object - * @param {Object} next - Next object - */ + /** + * Initialize auth. + * @param {Object} request Request object + * @param {Object} response Response object + * @param {Object} next Next object + */ init: function(request, response, next) { this.request = request; this.response = response; @@ -16,9 +16,9 @@ module.exports = { this.validateToken(); }, -/** - * Validate auth token - */ + /** + * Validate auth token. + */ validateToken: function() { let query = 'SELECT userId, ttl, created FROM salix.AccessToken WHERE id = ?'; @@ -31,25 +31,38 @@ module.exports = { if (this.isTokenExpired(token.created, token.ttl)) return this.response.status(401).send({message: 'Token expired'}); - this.request.userId = token.userId; + // Set proxy host + let proxy = config.proxy; + + if (!proxy) + proxy = { + host: 'localhost', + port: 80 + }; + + this.request.proxyHost = `http://${proxy.host}:${proxy.port}`; + this.request.user = { + id: token.userId, + token: this.getToken() + }; this.next(); }); }, -/** - * Get request token - * @return {String} Token - */ + /** + * Get request token. + * @return {String} Token + */ getToken: function() { return this.request.headers.authorization || this.request.query.token; }, -/** - * Checks if the token has expired - * @param {String} created - Creation date - * @param {Integer} ttl - Ttl seconds - * @return {Boolean} True if the token has expired - */ + /** + * Checks if the token has expired. + * @param {String} created Creation date + * @param {Integer} ttl Ttl seconds + * @return {Boolean} %true if the token has expired + */ isTokenExpired: function(created, ttl) { let date = new Date(created); let currentDate = new Date(); diff --git a/services/mailer/application/config.js b/services/mailer/application/config.js new file mode 100644 index 000000000..335441531 --- /dev/null +++ b/services/mailer/application/config.js @@ -0,0 +1,21 @@ +require('require-yaml'); +var fs = require('fs-extra'); + +let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; + +let config = require(`${__dirname}/config/datasources.json`); +let configEnvFile = `${__dirname}/config/datasources.${env}.json`; + +if (fs.existsSync(configEnvFile)) + Object.assign(config, require(configEnvFile)); + +let proxyConf = require(`../../nginx/config.yml`); +let proxyEnvFile = `../../nginx/config.${env}.yml`; + +if (fs.existsSync(proxyEnvFile)) + Object.assign(proxyConf, require(proxyEnvFile)); + +config.proxy = proxyConf; +config.package = require('../package.json'); + +module.exports = config; diff --git a/services/mailer/application/config/.gitignore b/services/mailer/application/config/.gitignore deleted file mode 100644 index 0ac46e95e..000000000 --- a/services/mailer/application/config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -smtp.test.json \ No newline at end of file diff --git a/services/mailer/application/config/app.json b/services/mailer/application/config/app.json deleted file mode 100644 index c9ec4174b..000000000 --- a/services/mailer/application/config/app.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "MailServer", - "version": "1.0.0", - "port": 3003, - "debug": false, - "defaultLanguage": "es", - "senderMail": "noreply@localhost", - "senderName": "" -} \ No newline at end of file diff --git a/services/mailer/application/config/app.test.json b/services/mailer/application/config/app.test.json deleted file mode 100644 index c9ec4174b..000000000 --- a/services/mailer/application/config/app.test.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "MailServer", - "version": "1.0.0", - "port": 3003, - "debug": false, - "defaultLanguage": "es", - "senderMail": "noreply@localhost", - "senderName": "" -} \ No newline at end of file diff --git a/services/mailer/application/config/datasources.json b/services/mailer/application/config/datasources.json new file mode 100644 index 000000000..865c68e47 --- /dev/null +++ b/services/mailer/application/config/datasources.json @@ -0,0 +1,29 @@ +{ + "app": { + "port": 3000, + "debug": false, + "defaultLanguage": "es", + "senderMail": "noreply@localhost", + "senderName": "MySender" + }, + "mysql": { + "host": "localhost", + "port": 3306, + "database": "vn", + "user": "root", + "password": "" + }, + "smtp": { + "host": "localhost", + "port": 465, + "secure": true, + "auth": { + "user": "noreply", + "pass": "" + }, + "tls": { + "rejectUnauthorized": false + }, + "pool": true + } +} \ No newline at end of file diff --git a/services/mailer/application/config/mysql.json b/services/mailer/application/config/mysql.json deleted file mode 100644 index ddfd88bed..000000000 --- a/services/mailer/application/config/mysql.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "host": "localhost", - "port": 3306, - "user": "reports", - "password": "", - "database": "" -} \ No newline at end of file diff --git a/services/mailer/application/config/mysql.test.json b/services/mailer/application/config/mysql.test.json deleted file mode 100644 index 5b00829b3..000000000 --- a/services/mailer/application/config/mysql.test.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "host": "localhost", - "port": 3306, - "user": "root", - "password": "", - "database": "vn" -} \ No newline at end of file diff --git a/services/mailer/application/config/smtp.json b/services/mailer/application/config/smtp.json deleted file mode 100644 index 1ffa81024..000000000 --- a/services/mailer/application/config/smtp.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "host": "localhost", - "port": 465, - "secure": true, - "auth": { - "user": "noreply", - "pass": "" - }, - "tls": { - "rejectUnauthorized": false - }, - "pool": true -} \ No newline at end of file diff --git a/services/mailer/application/database.js b/services/mailer/application/database.js index 53ce363f8..4fe4a0ba9 100644 --- a/services/mailer/application/database.js +++ b/services/mailer/application/database.js @@ -1,5 +1,5 @@ var mysql = require('mysql'); -let settings = require('./settings.js'); +let config = require('./config.js'); module.exports = { /** @@ -11,12 +11,12 @@ module.exports = { * Start database pool */ init: function() { - this.pool = mysql.createPool(settings.mysql()); + this.pool = mysql.createPool(config.mysql); this.pool.getConnection(function(error, connection) { if (error) { throw new Error('Can\'t connect to database: ' + error.code); - } else if (settings.app().debug) { + } else if (config.app.debug) { console.log('Database connection stablished'); } }); @@ -27,7 +27,7 @@ module.exports = { */ testEmail: function() { this.pool.query('SELECT fakeEmail as email FROM vn.config', function(error, qryRs) { - settings.testEmail = qryRs[0].email; + config.smtp.testEmail = qryRs[0].email; }); } }; diff --git a/services/mailer/application/locale.js b/services/mailer/application/locale.js index 496d48bb8..f9737fea3 100644 --- a/services/mailer/application/locale.js +++ b/services/mailer/application/locale.js @@ -1,5 +1,5 @@ var fs = require('fs'); -var settings = require('./settings.js'); +var config = require('./config.js'); var path = require('path'); module.exports = { @@ -11,7 +11,7 @@ module.exports = { */ load: function(template, countryCode, cb) { var localeFile = path.join(__dirname, 'template', `${template}`, 'locale', `${countryCode}.json`); - var defaultLocaleFile = path.join(__dirname, 'template', `${template}`, 'locale', `${settings.app().defaultLanguage}.json`); + var defaultLocaleFile = path.join(__dirname, 'template', `${template}`, 'locale', `${config.app.defaultLanguage}.json`); fs.stat(localeFile, (error, stats) => { if (error) { diff --git a/services/mailer/application/mail.js b/services/mailer/application/mail.js index 4807157a9..2cc8c7465 100644 --- a/services/mailer/application/mail.js +++ b/services/mailer/application/mail.js @@ -1,5 +1,5 @@ var nodemailer = require('nodemailer'); -var settings = require('./settings.js'); +var config = require('./config.js'); var template = require('./template.js'); var database = require('./database.js'); @@ -9,18 +9,22 @@ var database = require('./database.js'); module.exports = { transporter: null, /** - * Load mail settings. + * Load mail config. */ init: function() { - this.transporter = nodemailer.createTransport(settings.smtp()); + if (process.env.NODE_ENV == 'test') + return; + + this.transporter = nodemailer.createTransport(config.smtp); this.transporter.verify(function(error, success) { if (error) { - throw new Error(error); - } else if (settings.app().debug) { + console.error(error); + } else if (config.app.debug) { console.log('SMTP connection stablished'); } }); + }, /** @@ -33,17 +37,19 @@ module.exports = { * @param {Object} cb - Callback */ send: function(recipient, subject, body, attachments, params, cb) { + if (process.env.NODE_ENV == 'test') + return; + let mailOptions = { - from: '"' + settings.app().senderName + '" <' + settings.app().senderMail + '>', + from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>', to: recipient, subject: subject, html: body, attachments }; - if (settings.app().debug) { - mailOptions.to = settings.testEmail; - } + if (process.env.NODE_ENV != 'production') + mailOptions.to = config.smtp.testEmail; this.transporter.sendMail(mailOptions, (error, info) => { try { @@ -53,11 +59,11 @@ module.exports = { if (error) return cb(new Error('Email not sent: ' + error)); - if (settings.app().debug) + if (config.app.debug) console.log('Mail sent ' + info.messageId + ' [' + info.response + ']'); cb(); - } catch(e) { + } catch (e) { throw e; } }); @@ -70,10 +76,16 @@ module.exports = { * @param {Object} cb - Callback */ sendWithTemplate: function(tplName, params, cb) { - template.get(tplName, params, false, (error, result) => { + template.get(tplName, params, (error, result) => { if (error) return cb(error); + // Custom attachments + if (params.attachments) + params.attachments.forEach(function(attachment) { + result.attachments.push(attachment); + }); + this.send(result.recipient, result.subject, result.body, result.attachments, params, error => { if (error) return cb(error); @@ -96,10 +108,10 @@ module.exports = { log: function(senderId, recipientId, sender, subject, body, plainTextBody, status) { let qry = `INSERT INTO mail(senderFk, recipientFk, sender, replyTo, subject, body, plainTextBody, sent, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`; - let qryParams = [senderId, recipientId, sender, settings.app().senderMail, subject, body, plainTextBody, 1, status]; + let qryParams = [senderId, recipientId, sender, config.app.senderMail, subject, body, plainTextBody, 1, status]; database.pool.query(qry, qryParams, function(error, result) { - if (settings.app().debug && error) + if (config.app.debug && error) console.log('Mail log: ' + error); }); } diff --git a/services/mailer/application/route/manuscript.js b/services/mailer/application/route/manuscript.js deleted file mode 100644 index 8e35c5d2d..000000000 --- a/services/mailer/application/route/manuscript.js +++ /dev/null @@ -1,85 +0,0 @@ -var express = require('express'); -var router = new express.Router(); -var mail = require('../mail.js'); -var template = require('../template.js'); -var httpRequest = require('request'); - -// Payment method changes -router.post('/payment-update/:clientId', function(request, response, next) { - mail.sendWithTemplate('payment-update', {recipient: request.params.clientId}, error => { - if (error) - return response.status(400).json({message: error.message}); - - return response.json(); - }); -}); - -// Printer setup -router.post('/printer-setup/:clientId', function(request, response, next) { - mail.sendWithTemplate('printer-setup', {recipient: request.params.clientId}, error => { - if (error) - return response.status(400).json({message: error.message}); - - return response.json(); - }); -}); - -// Printer setup preview -router.get('/printer-setup/:clientId', function(request, response, next) { - template.get('printer-setup', {recipient: request.params.clientId}, true, (error, result) => { - if (error) - return response.status(400).json({message: error.message}); - - response.send(result.body); - }); -}); - -// Client welcome -router.post('/client-welcome/:clientId', function(request, response, next) { - mail.sendWithTemplate('client-welcome', {recipient: request.params.clientId}, error => { - if (error) - return response.status(400).json({message: error.message}); - - return response.json(); - }); -}); - -// Client welcome preview -router.get('/client-welcome/:clientId', function(request, response, next) { - template.get('client-welcome', {recipient: request.params.clientId}, true, (error, result) => { - if (error) - return response.status(400).json({message: error.message}); - - response.send(result.body); - }); -}); - -// Sepa core -router.post('/sepa-core/:clientId', function(request, response, next) { - var options = { - url: 'http://localhost:3008/manuscript/sepa-core/7422', - method: 'POST', - headers: { - 'authorization': request.headers.authorization - } - } - - let httpStream = httpRequest(options, function(error, httpResponse, body) { - if (error) - return response.status(400).json({message: httpResponse.message}); - }); - - if (httpStream) - mail.send('joan@verdnatura.es', 'Correu de prova', 'test message', [{filename: 'test.pdf', content: httpStream}], function(error, result) { - if (error) - return response.status(400).json({message: error.message}); - }); - /* mail.sendWithTemplate('sepa-core', {recipient: request.params.clientId}, error => { - if (error) - return response.status(400).json({message: error.message}); - - return response.json(); - }); */ -}); - -module.exports = router; diff --git a/services/mailer/application/route/notification.js b/services/mailer/application/route/notification.js index e5d5e4beb..0c7ac4e0e 100644 --- a/services/mailer/application/route/notification.js +++ b/services/mailer/application/route/notification.js @@ -1,8 +1,231 @@ var express = require('express'); var router = new express.Router(); +var config = require('../config.js'); var mail = require('../mail.js'); -var database = require('../database.js'); -var settings = require('../settings.js'); +var template = require('../template.js'); +var httpRequest = require('request'); +var auth = require('../auth.js'); + +// Auth middleware +var requestToken = function(request, response, next) { + auth.init(request, response, next); +}; + +// Printer setup +router.get('/printer-setup/:clientId', requestToken, function(request, response) { + mail.sendWithTemplate('printer-setup', {clientId: request.params.clientId}, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Printer setup preview +router.get('/printer-setup/:clientId/preview', requestToken, function(request, response) { + template.get('printer-setup', {clientId: request.params.clientId, isPreview: true}, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// Client welcome +router.get('/client-welcome/:clientId', requestToken, function(request, response) { + mail.sendWithTemplate('client-welcome', {clientId: request.params.clientId}, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Client welcome preview +router.get('/client-welcome/:clientId/preview', requestToken, function(request, response) { + template.get('client-welcome', {clientId: request.params.clientId, isPreview: true}, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// Client SEPA CORE +router.get('/sepa-core/:companyId/:clientId', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId + }; + + let path = `${request.proxyHost}/print/manuscript/sepa-core/${params.companyId}/${params.clientId}`; + let options = { + url: path, + method: 'GET', + headers: { + 'Authorization': request.headers.authorization + } + } + + let httpStream = httpRequest(options, function(error, httpResponse, body) { + if (error || httpResponse.statusCode != 200) + return response.status(400).json({message: error}); + }); + + if (httpStream) + params.attachments = [{filename: 'sepa-core.pdf', content: httpStream}]; + + mail.sendWithTemplate('sepa-core', params, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Client SEPA CORE preview +router.get('/sepa-core/:companyId/:clientId/preview', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token, + isPreview: true + }; + + template.get('sepa-core', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// First debtor letter +router.get('/letter-debtor-st/:companyId/:clientId', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token + }; + + let path = `${request.proxyHost}/print/manuscript/letter-debtor/${params.companyId}/${params.clientId}`; + let options = { + url: path, + method: 'GET', + headers: { + 'Authorization': request.headers.authorization + } + } + + let httpStream = httpRequest(options, function(error, httpResponse, body) { + if (error || httpResponse.statusCode != 200) + return response.status(400).json({message: error}); + }); + + if (httpStream) + params.attachments = [{filename: 'extracto.pdf', content: httpStream}]; + + mail.sendWithTemplate('letter-debtor-st', params, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// First debtor letter preview +router.get('/letter-debtor-st/:companyId/:clientId/preview', requestToken, function(request, response) { + template.get('letter-debtor-st', { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token, + isPreview: true + }, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// Second debtor letter +router.get('/letter-debtor-nd/:companyId/:clientId', requestToken, function(request, response) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token + }; + + let path = `${request.proxyHost}/print/manuscript/letter-debtor/${params.companyId}/${params.clientId}`; + let options = { + url: path, + method: 'GET', + headers: { + 'Authorization': request.headers.authorization + } + } + + let httpStream = httpRequest(options, function(error, httpResponse, body) { + if (error || httpResponse.statusCode != 200) + return response.status(400).json({message: error}); + }); + + if (httpStream) + params.attachments = [{filename: 'extracto.pdf', content: httpStream}]; + + mail.sendWithTemplate('letter-debtor-nd', params, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Second debtor letter preview +router.get('/letter-debtor-nd/:companyId/:clientId/preview', requestToken, function(request, response) { + template.get('letter-debtor-nd', { + clientId: request.params.clientId, + companyId: request.params.companyId, + token: request.user.token, + isPreview: true + }, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); +}); + +// Payment method changes +router.get('/payment-update/:clientId', requestToken, function(request, response) { + mail.sendWithTemplate('payment-update', {clientId: request.params.clientId}, error => { + if (error) + return response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +// Send notification to alias creditInsurance on client deactivate +router.get('/client-deactivate/:clientId', requestToken, function(request, response) { + var params = { + alias: 'creditInsurance', + code: 'clientDeactivate', + bodyParams: { + clientId: request.params.clientId + } + }; + + mail.sendWithTemplate('notification-alias', params, error => { + if (error) + response.status(400).json({message: error.message}); + + return response.json(); + }); +}); + +module.exports = router; + // Single user notification /* router.post('/:recipient/noticeUserSend', function(request, response) { @@ -62,24 +285,4 @@ var settings = require('../settings.js'); mail.sendWithTemplate('notification-notice', params, result => { return response.json(result); }); -}); */ - -// Send notification to alias solunion on client deactivate -router.post('/client-deactivate/:clientId', function(request, response) { - var params = { - alias: 'solunion', - code: 'clientDeactivate', - bodyParams: { - clientId: request.params.clientId - } - }; - - mail.sendWithTemplate('notification-alias', params, error => { - if (error) - response.status(400).json({message: error.message}); - - return response.json(); - }); -}); - -module.exports = router; +}); */ \ No newline at end of file diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js index b51b8a195..161271820 100644 --- a/services/mailer/application/router.js +++ b/services/mailer/application/router.js @@ -1,16 +1,30 @@ var express = require('express'); var router = new express.Router(); -var settings = require('./settings.js'); +var fs = require('fs'); +var path = require('path'); // Mailer default page router.get('/', function(request, response) { response.json({}); }); -// Manuscripts -router.use('/manuscript', require('./route/manuscript.js')); - // Notifications router.use('/notification', require('./route/notification.js')); +// Serve static images +router.use('/static/:template/:image', function(request, response) { + let imagePath = path.join(__dirname, '/template/', request.params.template, '/image/', request.params.image); + + fs.stat(imagePath, function(error) { + if (error) + return response.json({message: 'Image not found'}); + + let readStream = fs.createReadStream(imagePath); + + readStream.on('open', function() { + readStream.pipe(response); + }); + }); +}); + module.exports = router; diff --git a/services/mailer/application/settings.js b/services/mailer/application/settings.js deleted file mode 100644 index 3858cf719..000000000 --- a/services/mailer/application/settings.js +++ /dev/null @@ -1,45 +0,0 @@ -var path = require('path'); -/** - * Módulo de configuración - */ -module.exports = { - /** - * Obtiene la configuración en función del entorno en el que se está - * ejecutando la aplicación. - * @param {String} name Nombre del fichero - * @return {Object} Objeto de configuración - */ - getConfig: function(name) { - let env = process.env.NODE_ENV; - - if (!env) - env = 'development'; - - return require(path.join(__dirname, 'config', `${name}.${env}.json`)); - }, - /** - * Configuración de la aplicación - * @return {Object} Objeto de configuración app - */ - app: function() { - return this.getConfig('app'); - }, - /** - * Configuración de smtp - * @return {Object} Objeto de configuración smtp - */ - smtp: function() { - return this.getConfig('smtp'); - }, - /** - * Configuración de mysql - * @return {Object} Objeto de configuración MySQL - */ - mysql: function() { - return this.getConfig('mysql'); - }, - - testEmail: function() { - return this.getConfig('app').testEmail; - } -}; diff --git a/services/mailer/application/template.js b/services/mailer/application/template.js index 382b7202d..1e9c92fde 100644 --- a/services/mailer/application/template.js +++ b/services/mailer/application/template.js @@ -1,8 +1,8 @@ var fs = require('fs'); var mustache = require('mustache'); var locale = require('./locale.js'); -var path = require('path'); var inlineCss = require('inline-css'); +var path = require('path'); module.exports = { /** @@ -12,10 +12,10 @@ module.exports = { * @param {Object} params - Params * @param {Object} cb - Callback */ - get: function(template, params, isPreview, cb) { + get: function(template, params, cb) { var templatePath = path.join(__dirname, 'template', `${template}`, `index.html`); var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`); - var stylePath = path.join(__dirname, '../static', 'css', 'style.css'); + var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css'); fs.stat(templatePath, (error, stat) => { if (error) @@ -24,14 +24,26 @@ module.exports = { let TemplateClass = require(classPath); let instance = new TemplateClass(); - let getRenderedStyles = body => { + let getRenderedStyles = (error, body) => { + if (error) + return cb(error); + this.renderStyles(stylePath, body, (error, body) => { + if (error) + return cb(error); + + // Check if has a subject param params.subject = params.subject || instance.subject; - if (params.subject == undefined) - params.subject = body.match(new RegExp('(.*?)', 'i'))[1]; + if (params.subject == undefined) { + // Try to find a subject from Html source + let title = body.match(new RegExp('(.*?)', 'i')); - this.getAttachments(template, body, isPreview, (error, result) => { + if (title) + params.subject = title[1]; + } + + this.getAttachments(template, body, params.isPreview, (error, result) => { if (error) return cb(error); @@ -41,7 +53,7 @@ module.exports = { }; let getDataCb = () => { - this.render(templatePath, instance, (error, result) => getRenderedStyles(result)); + this.render(templatePath, instance, (error, result) => getRenderedStyles(error, result)); }; instance.getData(params, (error, result) => { @@ -53,6 +65,8 @@ module.exports = { return cb(error); instance._ = result.locale; + instance.isPreview = params.isPreview; + getDataCb(null, result); }); }); @@ -66,9 +80,54 @@ module.exports = { * @param {Object} cb - Callback */ render: function(path, data, cb) { - fs.readFile(path, 'utf8', function(error, body) { - mustache.parse(body); - cb(null, mustache.render(body, data)); + fs.readFile(path, 'utf8', (error, body) => { + // Find matching sub-templates + let regexp = new RegExp(/\{\{\$\.(.*?)\}\}/, 'ig'); + let subTpl = body.match(regexp); + + if (!subTpl) { + mustache.parse(body); + return cb(null, mustache.render(body, data)); + } + + let parentBody = body; + this.renderSub(parentBody, subTpl, data, regexp, (error, body) => { + if (error) + return cb(error); + + mustache.parse(body); + cb(null, mustache.render(body, data)); + }); + }); + }, + +/** + * Render sub-template + * @param {String} body - Raw body + * @param {Object} subTpl - Sub-template name + * @param {Object} data - Params + * @param {Object} regexp - Regexp + * @param {Object} cb - Callback + */ + renderSub: function(body, subTpl, data, regexp, cb) { + let index = 1; + + subTpl.forEach(keyName => { + subTplName = keyName.replace(regexp, '$1'); + + this.get(subTplName, data, (error, result) => { + if (error) + return cb(error); + + let subTplBody = result.body; + body = body.replace(keyName, subTplBody); + + if (index === subTpl.length) + cb(null, body); + + index++; + }); + }); }, @@ -78,18 +137,25 @@ module.exports = { * @param {String} body - Rendered html * @param {Object} cb - Callback */ - renderStyles: function(path, html, cb) { - fs.stat(path, error => { - if (error) return cb(new Error('Template stylesheet not found')); - fs.readFile(path, 'utf8', (error, css) => { - let style = ''; - let body = style + html; - let options = {url: ' '}; + renderStyles: function(stylePath, html, cb) { + // Common components + let comPath = path.join(__dirname, '../', 'static', 'css', 'component.css'); - inlineCss(body, options) - .then(function(body) { - cb(null, body); - }); + fs.readFile(comPath, 'utf8', (error, comCss) => { + fs.stat(stylePath, error => { + if (error) + return cb(new Error('Template stylesheet not found')); + + fs.readFile(stylePath, 'utf8', (error, css) => { + let style = ''; + let body = style + html; + let options = {url: ' '}; + + inlineCss(body, options) + .then(function(body) { + cb(null, body); + }); + }); }); }); }, @@ -104,16 +170,22 @@ module.exports = { let attachments = []; let tplAttachments = body.match(new RegExp('src="cid:(.*?)"', 'ig')); + if (!tplAttachments) + tplAttachments = {}; + // Template default attachments for (var i = 0; i < tplAttachments.length; i++) { - let name = tplAttachments[i].replace('src="cid:', '').replace('"', ''); + let src = tplAttachments[i].replace('src="cid:', '').replace('"', '').split('/'); + let attachmentTpl = src[0]; + let attachment = src[1]; if (isPreview) { - let attachmentPath = `/mailer/static/images/${name}`; + let attachmentPath = `/mailer/static/${attachmentTpl}/${attachment}`; body = body.replace(tplAttachments[i], `src="${attachmentPath}"`); } else { - let attachmentPath = path.join(__dirname, '../static', 'images', name); - attachments.push({filename: name, path: attachmentPath, cid: name}); + let attachmentPath = path.join(__dirname, 'template', `${attachmentTpl}`, 'image', attachment); + let attachmentName = attachmentTpl + '/' + attachment; + attachments.push({filename: attachmentName, path: attachmentPath, cid: attachmentName}); } } @@ -125,7 +197,7 @@ module.exports = { fs.stat(attachmentsPath, (error, stats) => { if (error) - return cb(new Error(`Could not load attachments.js from template ${template}`)); + return cb(null, {body: body, attachments: attachments}); let attachObj = require(attachmentsPath); @@ -145,10 +217,10 @@ module.exports = { }, /** - * Check all template attachments - * @param {Object} attachments - Attachments object - * @param {Object} cb - Callback - */ +* Check all template attachments +* @param {Object} attachments - Attachments object +* @param {Object} cb - Callback +*/ checkAttachments: function(attachments, cb) { for (var i = 0; i < attachments.length; i++) { var attachment = attachments[i]; @@ -159,4 +231,4 @@ module.exports = { } cb(); } -}; +}; \ No newline at end of file diff --git a/services/mailer/application/template/client-welcome/client-welcome.js b/services/mailer/application/template/client-welcome/client-welcome.js index 851c9a12e..7cf435d0e 100644 --- a/services/mailer/application/template/client-welcome/client-welcome.js +++ b/services/mailer/application/template/client-welcome/client-welcome.js @@ -5,6 +5,7 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class ClientWelcome { getData(params, cb) { let query = `SELECT + c.id clientId, CONCAT(w.name, ' ', w.firstName) name, w.phone AS phone, CONCAT(wu.name, '@verdnatura.es') AS email, @@ -13,11 +14,12 @@ module.exports = class ClientWelcome { c.email recipient FROM client c JOIN account.user u ON u.id = c.id - LEFT JOIN worker w ON w.id = c.workerFk + LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN account.user wu ON wu.id = w.userFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; - database.pool.query(query, [params.recipient], (error, result) => { + + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); diff --git a/services/mailer/application/template/client-welcome/index.html b/services/mailer/application/template/client-welcome/index.html index 661f0986a..6d25bcd7e 100644 --- a/services/mailer/application/template/client-welcome/index.html +++ b/services/mailer/application/template/client-welcome/index.html @@ -7,11 +7,9 @@
- - - + + {{$.header}} +
@@ -21,108 +19,48 @@
-

{{_.dear}},

-

{{_.bodyDescription}}

- -

- Sus datos para poder comprar en la web de verdnatura (https://www.verdnatura.es) - o en nuestras aplicaciones para iOS (https://goo.gl/3hC2mG) y Android (https://goo.gl/8obvLc), son: -

- +

{{_.dear}}

+

{{{_.bodyDescription}}}

-

Usuario: {{userName}}
-
Contraseña: ******** (Va a recibir un correo para establecer la contraseña)
+
{{_.clientNumber}} {{clientId}}
+
{{_.user}} {{userName}}
+
{{_.password}} ******** {{{_.passwordResetText}}}

-

Cómo hacer un pedido

- -

Para realizar un pedido en nuestra web, debe configurarlo indicando:

- +

{{_.sectionHowToBuyTitle}}

+

{{_.sectionHowToBuyDescription}}

    -
  1. Si quiere recibir el pedido (por agencia o por nuestro propio reparto) o si lo prefiere recoger en alguno de nuestros almacenes.
  2. -
  3. La fecha en la que quiera recibir el pedido (se preparará el día anterior).
  4. -
  5. La dirección de entrega o el almacén donde quiera recoger el pedido.
  6. +
  7. {{_.sectionHowToBuyRequeriment1}}
  8. +
  9. {{_.sectionHowToBuyRequeriment2}}
  10. +
  11. {{_.sectionHowToBuyRequeriment3}}
- -

En nuestra web y aplicaciones puedes visualizar el stock disponible de flor cortada, verdes, plantas, complementos y artificial. - Tenga en cuenta que dicho stock puede variar en función de la fecha seleccionada al configurar el pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.

- -

El reparto se realiza de lunes a sábado según la zona en la que se encuentre. Por regla general, los pedidos que se entregan por agencia, deben estar confirmados y pagados antes de las 17h - del día en que se preparan (el día anterior a recibirlos), aunque esto puede variar si el pedido se envía a través de nuestro reparto y según la zona.

- -

Cómo pagar

- -

Las formas de pago admitidas en Verdnatura son

- +

{{_.sectionHowToBuyStock}}

+

{{_.sectionHowToBuyDelivery}}

+ +

{{_.sectionHowToPayTitle}}

+

{{_.sectionHowToPayDescription}}

    -
  • Con tarjeta a través de nuestra plataforma web (al confirmar el pedido).
  • -
  • Mediante giro bancario mensual, modalidad que hay que solicitar y tramitar.
  • +
  • {{{_.sectionHowToPayOption1}}}
  • +
  • {{{_.sectionHowToPayOption2}}}
-

Cosas a tener en cuenta

- -

Verdnatura vende EXCLUSIVAMENTE a profesionales, por lo que debe remitirnos el Modelo 036 ó 037, - para comprobar que está dado/a de alta en el epígrafe correspondiente al comercio de flores.

- -

POLÍTICA DE RECLAMACIONES

- -

Verdnatura aceptará las reclamaciones que se realicen dentro de los dos días naturales - siguientes a la recepción del pedido (incluyendo el mismo día de la recepción). Pasado este plazo no se aceptará ninguna reclamación.

- -

Cualquier duda que le surja, no dude en consultarla, ¡estamos para atenderle!

+

{{_.sectionToConsiderTitle}}

+

{{_.sectionToConsiderDescription}}

+

{{_.sectionClaimsPolicyTitle}}

+

{{_.sectionClaimsPolicyDescription}}

+

{{{_.doubtsText}}}

{{{salesPersonName}}} {{{salesPersonPhone}}} {{{salesPersonEmail}}}

- -
- - - - - - - - - -
-

{{_.fiscalAddress}}

-

{{_.privacy}}

-

{{_.privacyLaw}}

-
- + + {{$.footer}} +
diff --git a/services/mailer/application/template/client-welcome/locale/es.json b/services/mailer/application/template/client-welcome/locale/es.json index c99fe0c8e..95a903e5c 100644 --- a/services/mailer/application/template/client-welcome/locale/es.json +++ b/services/mailer/application/template/client-welcome/locale/es.json @@ -1,14 +1,29 @@ { "subject": "¡Le damos la bienvenida!", "title": "¡LE DAMOS LA BIENVENIDA!", - "dear": "Estimado cliente", - "bodyDescription": "Siga las intrucciones especificadas en este correo para llevar a cabo la instalación de la impresora.", + "dear": "Estimado cliente,", + "bodyDescription": "Sus datos para poder comprar en la web de verdnatura (https://www.verdnatura.es) o en nuestras aplicaciones para iOS y Android (Ver tutorial de uso), son:", + "clientNumber": "Identificador de cliente:", + "user": "Usuario:", + "password": "Contraseña:", + "passwordResetText": "(Haga clic en \"¿Has olvidado tu contraseña?\")", + "sectionHowToBuyTitle": "Cómo hacer un pedido", + "sectionHowToBuyDescription": "Para realizar un pedido en nuestra web, debe configurarlo indicando:", + "sectionHowToBuyRequeriment1": "Si quiere recibir el pedido (por agencia o por nuestro propio reparto) o si lo prefiere recoger en alguno de nuestros almacenes.", + "sectionHowToBuyRequeriment2": "La fecha en la que quiera recibir el pedido (se preparará el día anterior).", + "sectionHowToBuyRequeriment3": "La dirección de entrega o el almacén donde quiera recoger el pedido.", + "sectionHowToBuyStock": "En nuestra web y aplicaciones puedes visualizar el stock disponible de flor cortada, verdes, plantas, complementos y artificial. Tenga en cuenta que dicho stock puede variar en función de la fecha seleccionada al configurar el pedido. Es importante CONFIRMAR los pedidos para que la mercancía quede reservada.", + "sectionHowToBuyDelivery": "El reparto se realiza de lunes a sábado según la zona en la que se encuentre. Por regla general, los pedidos que se entregan por agencia, deben estar confirmados y pagados antes de las 17h del día en que se preparan (el día anterior a recibirlos), aunque esto puede variar si el pedido se envía a través de nuestro reparto y según la zona.", + "sectionHowToPayTitle": "Cómo pagar", + "sectionHowToPayDescription": "Las formas de pago admitidas en Verdnatura son:", + "sectionHowToPayOption1": "Con tarjeta a través de nuestra plataforma web (al confirmar el pedido).", + "sectionHowToPayOption2": "Mediante giro bancario mensual, modalidad que hay que solicitar y tramitar.", + "sectionToConsiderTitle": "Cosas a tener en cuenta", + "sectionToConsiderDescription": "Verdnatura vende EXCLUSIVAMENTE a profesionales, por lo que debe remitirnos el Modelo 036 ó 037, para comprobar que está dado/a de alta en el epígrafe correspondiente al comercio de flores.", + "sectionClaimsPolicyTitle": "POLÍTICA DE RECLAMACIONES", + "sectionClaimsPolicyDescription": "Verdnatura aceptará las reclamaciones que se realicen dentro de los dos días naturales siguientes a la recepción del pedido (incluyendo el mismo día de la recepción). Pasado este plazo no se aceptará ninguna reclamación.", + "doubtsText": "Cualquier duda que le surja, no dude en consultarla, ¡estamos para atenderle!", "salesPersonNameText": "Soy tu comercial y mi nombre es", "salesPersonPhoneText": "Teléfono y whatsapp", - "salesPersonEmailText": "Dirección de e-mail", - "actionButton": "Visita nuestra Web", - "infoButton": "Ayúdanos a mejorar", - "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", - "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", - "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." + "salesPersonEmailText": "Dirección de e-mail" } \ No newline at end of file diff --git a/services/mailer/application/template/client-welcome/style.css b/services/mailer/application/template/client-welcome/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/default/image/download.svg b/services/mailer/application/template/default/image/download.svg new file mode 100644 index 000000000..b05bc05c8 --- /dev/null +++ b/services/mailer/application/template/default/image/download.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/services/mailer/application/template/default/image/preview.svg b/services/mailer/application/template/default/image/preview.svg new file mode 100644 index 000000000..09a2a6bca --- /dev/null +++ b/services/mailer/application/template/default/image/preview.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/services/mailer/application/template/footer/footer.js b/services/mailer/application/template/footer/footer.js new file mode 100644 index 000000000..555e70b10 --- /dev/null +++ b/services/mailer/application/template/footer/footer.js @@ -0,0 +1,21 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class Footer { + getData(params, cb) { + let query = `SELECT + socialName, + LOWER(ct.code) countryCode + FROM client c + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } +}; diff --git a/services/mailer/static/images/action.png b/services/mailer/application/template/footer/image/action.png similarity index 100% rename from services/mailer/static/images/action.png rename to services/mailer/application/template/footer/image/action.png diff --git a/services/mailer/static/images/facebook.png b/services/mailer/application/template/footer/image/facebook.png similarity index 100% rename from services/mailer/static/images/facebook.png rename to services/mailer/application/template/footer/image/facebook.png diff --git a/services/mailer/static/images/header.png b/services/mailer/application/template/footer/image/header.png similarity index 100% rename from services/mailer/static/images/header.png rename to services/mailer/application/template/footer/image/header.png diff --git a/services/mailer/static/images/info.png b/services/mailer/application/template/footer/image/info.png similarity index 100% rename from services/mailer/static/images/info.png rename to services/mailer/application/template/footer/image/info.png diff --git a/services/mailer/static/images/instagram.png b/services/mailer/application/template/footer/image/instagram.png similarity index 100% rename from services/mailer/static/images/instagram.png rename to services/mailer/application/template/footer/image/instagram.png diff --git a/services/mailer/static/images/linkedin.png b/services/mailer/application/template/footer/image/linkedin.png similarity index 100% rename from services/mailer/static/images/linkedin.png rename to services/mailer/application/template/footer/image/linkedin.png diff --git a/services/mailer/static/images/pinterest.png b/services/mailer/application/template/footer/image/pinterest.png similarity index 100% rename from services/mailer/static/images/pinterest.png rename to services/mailer/application/template/footer/image/pinterest.png diff --git a/services/mailer/static/images/twitter.png b/services/mailer/application/template/footer/image/twitter.png similarity index 100% rename from services/mailer/static/images/twitter.png rename to services/mailer/application/template/footer/image/twitter.png diff --git a/services/mailer/static/images/youtube.png b/services/mailer/application/template/footer/image/youtube.png similarity index 100% rename from services/mailer/static/images/youtube.png rename to services/mailer/application/template/footer/image/youtube.png diff --git a/services/mailer/application/template/footer/index.html b/services/mailer/application/template/footer/index.html new file mode 100644 index 000000000..484f5c2b8 --- /dev/null +++ b/services/mailer/application/template/footer/index.html @@ -0,0 +1,42 @@ + + + + + + + + + +
+

{{_.fiscalAddress}}

+

{{_.privacy}}

+

{{_.privacyLaw}}

+
+ \ No newline at end of file diff --git a/services/mailer/application/template/footer/locale/es.json b/services/mailer/application/template/footer/locale/es.json new file mode 100644 index 000000000..1ad532d34 --- /dev/null +++ b/services/mailer/application/template/footer/locale/es.json @@ -0,0 +1,7 @@ +{ + "actionButton": "Visita nuestra Web", + "infoButton": "Ayúdanos a mejorar", + "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es", + "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", + "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." +} \ No newline at end of file diff --git a/services/mailer/static/css/style.css b/services/mailer/application/template/footer/style.css similarity index 58% rename from services/mailer/static/css/style.css rename to services/mailer/application/template/footer/style.css index 1243a091c..f35364e8c 100644 --- a/services/mailer/static/css/style.css +++ b/services/mailer/application/template/footer/style.css @@ -1,41 +1,3 @@ -img { - margin: 0 -} - -.wrapper { - background-color: #EEE -} - -.container { - font-family: arial, sans-serif; - max-width: 600px; - min-width: 320px; - font-size: 16px; - margin: 0 auto; - color: #555 -} - -.banner img { - width: 100% -} - -.title { - background-color: #95d831; - text-align: center; - padding: 35px 0 -} - -.title h1 { - font-size: 32px; - color: #333; - margin: 0 -} - -.body { - background-color:#FFF; - padding: 20px -} - .buttons { background-color: #FFF; text-align: center; diff --git a/services/mailer/application/template/header/header.js b/services/mailer/application/template/header/header.js new file mode 100644 index 000000000..a6d1d6194 --- /dev/null +++ b/services/mailer/application/template/header/header.js @@ -0,0 +1,21 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class Header { + getData(params, cb) { + let query = `SELECT + c.name AS clientName, + LOWER(ct.code) countryCode + FROM client c + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } +}; diff --git a/services/mailer/application/template/header/image/logo.png b/services/mailer/application/template/header/image/logo.png new file mode 100644 index 000000000..3c063ae44 Binary files /dev/null and b/services/mailer/application/template/header/image/logo.png differ diff --git a/services/mailer/application/template/header/index.html b/services/mailer/application/template/header/index.html new file mode 100644 index 000000000..6e4fcf8a4 --- /dev/null +++ b/services/mailer/application/template/header/index.html @@ -0,0 +1,3 @@ +
+ VerdNatura +
diff --git a/services/mailer/application/template/header/locale/es.json b/services/mailer/application/template/header/locale/es.json new file mode 100644 index 000000000..7a73a41bf --- /dev/null +++ b/services/mailer/application/template/header/locale/es.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/services/mailer/application/template/header/style.css b/services/mailer/application/template/header/style.css new file mode 100644 index 000000000..4ea8ee36d --- /dev/null +++ b/services/mailer/application/template/header/style.css @@ -0,0 +1,3 @@ +.banner img { + width: 100% +} \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-nd/attachment.json b/services/mailer/application/template/letter-debtor-nd/attachment.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/attachment.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-nd/index.html b/services/mailer/application/template/letter-debtor-nd/index.html new file mode 100644 index 000000000..aa4379519 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/index.html @@ -0,0 +1,87 @@ + + + + {{_.subject}} + + + +
+
+ + {{$.header}} + + + +
+

{{_.title}}

+
+ + + +
+

{{_.dear}}

+ +

{{_.bodyDescription}}

+

{{_.termLimits}}

+

+ {{_.payMethod}} + +

    +
  1. {{_.payMethodOption1}}
  2. +
  3. {{_.payMethodOption2}}
  4. +
+

+

+ {{_.legalActions}} +

    +
  1. {{_.legalActionsOption1}}
  2. +
  3. {{_.legalActionsOption2}}
  4. +
  5. {{_.legalActionsOption3}}
  6. +
+

+ +

{{_.contact}}

+ +

{{_.waitingForNews}}

+

{{_.conclusion}}

+ +

+

+
{{bankName}}
+
{{iban}}
+
+
{{_.accountTransferData}}
+
+
+

+ + {{#isPreview}} + +
+
+ Ver adjunto +
+ Ver adjunto +
+
+ + +
+
+ Descargar adjunto +
+ Descargar PDF +
+
+ {{/isPreview}} +
+ + + + + {{$.footer}} + +
+
+ + \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js b/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js new file mode 100644 index 000000000..be0f996e1 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/letter-debtor-nd.js @@ -0,0 +1,39 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class LetterDebtorNd { + getData(params, cb) { + let query = `SELECT + sa.iban, + be.name AS bankName, + LOWER(ct.code) countryCode, + c.email recipient + FROM client c + JOIN company AS cny + JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk + JOIN bankEntity be ON be.id = sa.bankEntityFk + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ? AND cny.id = ?`; + + this.clientId = params.clientId; + this.companyId = params.companyId; + this.token = params.token; + + database.pool.query(query, [params.clientId, params.companyId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + + cb(); + }); + } + + get previewAttachments() { + if (this.isPreview) + return `` + + '
Descargar adjunto
' + + 'extracto.pdf
'; + } +}; diff --git a/services/mailer/application/template/letter-debtor-nd/locale/es.json b/services/mailer/application/template/letter-debtor-nd/locale/es.json new file mode 100644 index 000000000..1f8790eba --- /dev/null +++ b/services/mailer/application/template/letter-debtor-nd/locale/es.json @@ -0,0 +1,18 @@ +{ + "subject": "Reiteración de aviso por saldo deudor", + "title": "AVISO REITERADO", + "dear": "Estimado cliente,", + "bodyDescription": "Nos dirigimos a Vd. nuevamente para informarle que sigue pendiente su deuda con nuestra empresa, tal y como puede comprobar en el extracto adjunto.", + "termLimits": "Dado que los plazos de pago acordados están ampliamente superados, no procede mayor dilación en la liquidación del importe adeudado.", + "payMethod": "Para ello dispone de las siguientes formas de pago:", + "payMethodOption1": "Pago online desde nuestra web", + "payMethodOption2": "Ingreso o transferencia al número de cuenta que detallamos al pie de esta carta, indicando el número de cliente.", + "legalActions": "En caso de no ser atendido este apremio de pago, nos veremos obligados a iniciar las acciones legales que procedan, entre las que están:", + "legalActionsOption1": "Inclusión en ficheros negativos sobre solvencia patrimonial y crédito.", + "legalActionsOption2": "Reclamación judicial", + "legalActionsOption3": "Cesión de deuda a una empresa de gestión de cobro", + "contact": "Para consultas, puede ponerse en contacto con nosotros en el 96 324 21 00.", + "waitingForNews": "En espera de sus noticias", + "conclusion": "Gracias por su atención.", + "accountTransferData": "Datos para transferencia bancaria" +} \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-nd/style.css b/services/mailer/application/template/letter-debtor-nd/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/letter-debtor-st/attachment.json b/services/mailer/application/template/letter-debtor-st/attachment.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/attachment.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-st/index.html b/services/mailer/application/template/letter-debtor-st/index.html new file mode 100644 index 000000000..a3b07e677 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/index.html @@ -0,0 +1,69 @@ + + + + {{_.subject}} + + + +
+
+ + {{$.header}} + + + +
+

{{_.title}}

+
+ + + +
+

{{_.dear}}

+ +

{{_.bodyDescription}}

+

{{_.viewExtract}}

+

{{_.validData}}

+

{{_.payMethod}}

+

{{_.conclusion}}

+ +

+

+
{{bankName}}
+
{{iban}}
+
+
{{_.accountTransferData}}
+
+
+

+ + {{#isPreview}} + +
+
+ Ver adjunto +
+ Ver adjunto +
+
+ + +
+
+ Descargar adjunto +
+ Descargar PDF +
+
+ {{/isPreview}} +
+ + + + + {{$.footer}} + +
+
+ + \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js b/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js new file mode 100644 index 000000000..43ccb7a25 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/letter-debtor-st.js @@ -0,0 +1,39 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class LetterDebtorSt { + getData(params, cb) { + let query = `SELECT + sa.iban, + be.name AS bankName, + LOWER(ct.code) countryCode, + c.email recipient + FROM client c + JOIN company AS cny + JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk + JOIN bankEntity be ON be.id = sa.bankEntityFk + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ? AND cny.id = ?`; + + this.clientId = params.clientId; + this.companyId = params.companyId; + this.token = params.token; + + database.pool.query(query, [params.clientId, params.companyId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + + cb(); + }); + } + + get previewAttachments() { + if (this.isPreview) + return `` + + '
Descargar adjunto
' + + 'extracto.pdf
'; + } +}; diff --git a/services/mailer/application/template/letter-debtor-st/locale/es.json b/services/mailer/application/template/letter-debtor-st/locale/es.json new file mode 100644 index 000000000..558b18753 --- /dev/null +++ b/services/mailer/application/template/letter-debtor-st/locale/es.json @@ -0,0 +1,11 @@ +{ + "subject": "Aviso inicial por saldo deudor", + "title": "AVISO INICIAL", + "dear": "Estimado cliente,", + "bodyDescription": "Por el presente escrito le comunicamos que, según nuestros datos contables, su cuenta tiene un saldo pendiente de liquidar.", + "viewExtract": "Le solicitamos compruebe que el extracto adjunto corresponde con los datos de que Vd. dispone. Nuestro departamento de administración le aclarará gustosamente cualquier duda que pueda tener, e igualmente le facilitará cualquier documento que solicite.", + "validData": "Si al comprobar los datos aportados resultaran correctos, le rogamos proceda a regularizar su situación.", + "payMethod": "Si no desea desplazarse personalmente hasta nuestras oficinas, puede realizar el pago mediante transferencia bancaria a la cuenta que figura al pie del comunicado, indicando su número de cliente, o bien puede realizar el pago online desde nuestra página web.", + "conclusion": "De antemano le agradecemos su amable colaboración.", + "accountTransferData": "Datos para transferencia bancaria" +} \ No newline at end of file diff --git a/services/mailer/application/template/letter-debtor-st/style.css b/services/mailer/application/template/letter-debtor-st/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/notification-alias/index.html b/services/mailer/application/template/notification-alias/index.html index ab00f8ef6..6e79e1278 100644 --- a/services/mailer/application/template/notification-alias/index.html +++ b/services/mailer/application/template/notification-alias/index.html @@ -5,70 +5,29 @@ -
- -
- VerdNatura -
- +
+
+ + {{$.header}} + - -
-

{{_.title}}

-
- + +
+

{{_.title}}

+
+ - -
-

{{_.hello}}, #{{alias}}

-

{{message}}

-

- + +
+

{{_.hello}} #{{alias}}

+

{{message}}

+
+ - -
- - - - - - - -
-

{{_.fiscalAddress}}

-

{{_.privacy}}

-

{{_.privacyLaw}}

-
- -
\ No newline at end of file diff --git a/services/mailer/application/template/notification-alias/locale/es.json b/services/mailer/application/template/notification-alias/locale/es.json index 0deeb1604..6e39b7f63 100644 --- a/services/mailer/application/template/notification-alias/locale/es.json +++ b/services/mailer/application/template/notification-alias/locale/es.json @@ -1,16 +1,11 @@ { "subject": "Has recibido una nueva notificación", "title": "Nueva notificación", - "hello": "Hola", + "hello": "Hola,", "notificationCode": { "clientDeactivate": { "subject": "Gestionar baja de contrato", "message": "El cliente con id %clientId% está clasificado, por favor, gestione la baja del contrato primero." } - }, - "actionButton": "Visita nuestra Web", - "infoButton": "Ayúdanos a mejorar", - "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", - "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", - "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." + } } \ No newline at end of file diff --git a/services/mailer/application/template/notification-alias/style.css b/services/mailer/application/template/notification-alias/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/payment-update/index.html b/services/mailer/application/template/payment-update/index.html index caec77e90..78d6612c4 100644 --- a/services/mailer/application/template/payment-update/index.html +++ b/services/mailer/application/template/payment-update/index.html @@ -7,11 +7,9 @@
- - - + + {{$.header}} +
@@ -21,59 +19,20 @@
-

{{_.dear}},

-

{{_.bodyDescription}}

-

-

{{_.paymentMethod}}: {{payMethodName}}
+

{{_.dear}}

+

{{_.bodyDescription}}

+

+

{{_.paymentMethod}} {{payMethodName}}
{{{paymentDay}}}

-

{{paymentAdvice}}

-

{{_.notifyError}}

+

{{paymentAdvice}}

+

{{_.notifyError}}

- - - - - - - - - -
-

{{_.fiscalAddress}}

-

{{_.privacy}}

-

{{_.privacyLaw}}

-
- + + {{$.footer}} +
diff --git a/services/mailer/application/template/payment-update/locale/es.json b/services/mailer/application/template/payment-update/locale/es.json index 144cdc346..1216dcd99 100644 --- a/services/mailer/application/template/payment-update/locale/es.json +++ b/services/mailer/application/template/payment-update/locale/es.json @@ -1,18 +1,13 @@ { "subject": "Cambios en las condiciones de pago", "title": "Cambio en las condiciones", - "dear": "Estimado cliente", + "dear": "Estimado cliente,", "bodyDescription": "Le informamos que han cambiado las condiciones de pago de su cuenta. A continuación le indicamos las nuevas condiciones:", - "paymentMethod": "Método de pago", - "paymentDay": "Día de pago", + "paymentMethod": "Método de pago:", + "paymentDay": "Día de pago:", "everyMonth": "de cada mes", "cardPaymentAdvice": "Su modo de pago actual implica que deberá abonar el importe de los pedidos realizados en el mismo día para que se puedan enviar.", "accountPaymentAdviceBefore": "Su modo de pago actual implica que se le pasará un cargo a la cuenta", "accountPaymentAdviceAfter": "por el importe pendiente, al vencimiento establecido en las condiciones.", - "notifyError": "En el caso de detectar algún error en los datos indicados o para cualquier aclaración, debe dirigirse a su comercial.", - "actionButton": "Visita nuestra Web", - "infoButton": "Ayúdanos a mejorar", - "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", - "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", - "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." + "notifyError": "En el caso de detectar algún error en los datos indicados o para cualquier aclaración, debe dirigirse a su comercial." } \ No newline at end of file diff --git a/services/mailer/application/template/payment-update/payment-update.js b/services/mailer/application/template/payment-update/payment-update.js index d126dc83a..565fd8a74 100644 --- a/services/mailer/application/template/payment-update/payment-update.js +++ b/services/mailer/application/template/payment-update/payment-update.js @@ -4,7 +4,7 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class PaymentUpdate { getData(params, cb) { - let query = `SELECT + let query = `SELECT pm.id payMethodFk, pm.name payMethodName, c.dueDay, @@ -12,10 +12,13 @@ module.exports = class PaymentUpdate { LOWER(ct.code) countryCode, c.email recipient FROM client c - JOIN payMethod pm ON pm.id = c.paymentMethodFk + JOIN payMethod pm ON pm.id = c.payMethodFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; - database.pool.query(query, [params.recipient], (error, result) => { + + this.clientId = params.clientId; + + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); @@ -26,7 +29,7 @@ module.exports = class PaymentUpdate { get paymentDay() { if (this.payMethodFk != 5) - return `
${this._.paymentDay}: ${this.dueDay} ${this._.everyMonth}
`; + return `
${this._.paymentDay} ${this.dueDay} ${this._.everyMonth}
`; } get paymentAdvice() { diff --git a/services/mailer/application/template/payment-update/style.css b/services/mailer/application/template/payment-update/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/printer-setup/index.html b/services/mailer/application/template/printer-setup/index.html index 3f6c8910d..ee021281c 100644 --- a/services/mailer/application/template/printer-setup/index.html +++ b/services/mailer/application/template/printer-setup/index.html @@ -7,11 +7,9 @@
- - - + + {{$.header}} +
@@ -21,14 +19,14 @@
-

{{_.dear}},

-

{{_.bodyDescription}}

-

{{{_.followGuide}}}

+

{{_.dear}}

+

{{_.bodyDescription}}

+

{{{_.followGuide}}}

{{{_.downloadFrom}}}

-

{{_.sectionQLabelTitle}}

+

{{_.sectionQLabelTitle}}

-

{{_.sectionQLabelDescription}}

+

{{_.sectionQLabelDescription}}

  1. {{_.sectionQLabelStep1}}
  2. @@ -48,8 +46,9 @@
  3. {{_.sectionQLabelStep15}}
-

{{_.sectionHelpTitle}}

-

{{_.sectionHelpDescription}}

+

{{_.sectionHelpTitle}}

+ +

{{_.sectionHelpDescription}}

{{{_.sectionHelpDownloadRemoteSupport}}}

@@ -60,48 +59,9 @@

- - - - - - - - - -
-

{{_.fiscalAddress}}

-

{{_.privacy}}

-

{{_.privacyLaw}}

-
- + + {{$.footer}} +
diff --git a/services/mailer/application/template/printer-setup/locale/es.json b/services/mailer/application/template/printer-setup/locale/es.json index 41a831524..7d3da6646 100644 --- a/services/mailer/application/template/printer-setup/locale/es.json +++ b/services/mailer/application/template/printer-setup/locale/es.json @@ -1,7 +1,7 @@ { "subject": "Instalación y configuración de impresora", "title": "¡GRACIAS POR SU CONFIANZA!", - "dear": "Estimado cliente", + "dear": "Estimado cliente,", "bodyDescription": "Siga las intrucciones especificadas en este correo para llevar a cabo la instalación de la impresora.", "followGuide": "Puede utilizar como guía, el video del montaje del ribon y la cinta https://www.youtube.com/watch?v=qhb0kgQF3o8. También necesitará el QLabel, el programa para imprimir las cintas.", "downloadFrom": "Puede descargarlo desde este enlace http://www.godexintl.com/en/product/type/Download/2967", @@ -27,10 +27,5 @@ "sectionHelpDownloadRemoteSupport": "Puede descargarse el programa desde este enlace http://soporte.verdnatura.es.", "salesPersonNameText": "Soy su comercial y mi nombre es", "salesPersonPhoneText": "Teléfono y whatsapp", - "salesPersonEmailText": "Dirección de e-mail", - "actionButton": "Visita nuestra Web", - "infoButton": "Ayúdanos a mejorar", - "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", - "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", - "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." + "salesPersonEmailText": "Dirección de e-mail" } \ No newline at end of file diff --git a/services/mailer/application/template/printer-setup/printer-setup.js b/services/mailer/application/template/printer-setup/printer-setup.js index 77147f459..d17add406 100644 --- a/services/mailer/application/template/printer-setup/printer-setup.js +++ b/services/mailer/application/template/printer-setup/printer-setup.js @@ -4,18 +4,22 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class PrinterSetup { getData(params, cb) { - let query = `SELECT + let query = `SELECT CONCAT(w.name, ' ', w.firstName) name, w.phone AS phone, CONCAT(u.name, '@verdnatura.es') AS email, LOWER(ct.code) countryCode, c.email recipient FROM client c - LEFT JOIN worker w ON w.id = c.workerFk + LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = w.userFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; - database.pool.query(query, [params.recipient], (error, result) => { + + this.clientId = params.clientId; + this.isPreview = params.isPreview; + + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); diff --git a/services/mailer/application/template/printer-setup/style.css b/services/mailer/application/template/printer-setup/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/application/template/sepa-core/index.html b/services/mailer/application/template/sepa-core/index.html index df149cb9f..1acdae3fc 100644 --- a/services/mailer/application/template/sepa-core/index.html +++ b/services/mailer/application/template/sepa-core/index.html @@ -7,11 +7,9 @@
- - - + + {{$.header}} +
@@ -21,53 +19,35 @@
-

{{_.dear}},

-

{{_.bodyDescription}}

+

{{_.dear}}

+

{{_.bodyDescription}}

+

{{_.conclusion}}

+ + {{#isPreview}} + +
+
+ Ver adjunto +
+ Ver adjunto +
+
+ + +
+
+ Descargar adjunto +
+ Descargar PDF +
+
+ {{/isPreview}}
- - - - - - - - - -
-

{{_.fiscalAddress}}

-

{{_.privacy}}

-

{{_.privacyLaw}}

-
- + + {{$.footer}} +
diff --git a/services/mailer/application/template/sepa-core/locale/es.json b/services/mailer/application/template/sepa-core/locale/es.json index 29e0ef1a9..48eaadf3a 100644 --- a/services/mailer/application/template/sepa-core/locale/es.json +++ b/services/mailer/application/template/sepa-core/locale/es.json @@ -1,11 +1,7 @@ { - "subject": "Instalación y configuración de impresora", - "title": "¡GRACIAS POR SU CONFIANZA!", - "dear": "Estimado cliente", - "bodyDescription": "A continuación le adjuntamos el documento de domicilación de datos bancarios.", - "actionButton": "Visita nuestra Web", - "infoButton": "Ayúdanos a mejorar", - "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", - "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", - "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." + "subject": "Solicitud de domiciliación bancaria", + "title": "CAMBIOS EN SU FORMA DE PAGO", + "dear": "Estimado cliente,", + "bodyDescription": "Para poder tramitar su solicitud de cambio de su forma de pago a giro bancario, le adjuntamos los documentos correspondientes a la Ley de Pago, que tiene que cumplimentar y enviarnos.", + "conclusion": "Gracias por su atención." } \ No newline at end of file diff --git a/services/mailer/application/template/sepa-core/sepa-core.js b/services/mailer/application/template/sepa-core/sepa-core.js index 536448bf0..ec19dd29b 100644 --- a/services/mailer/application/template/sepa-core/sepa-core.js +++ b/services/mailer/application/template/sepa-core/sepa-core.js @@ -11,32 +11,22 @@ module.exports = class SepaCore { LOWER(ct.code) countryCode, c.email recipient FROM client c - LEFT JOIN worker w ON w.id = c.workerFk + LEFT JOIN worker w ON w.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = w.userFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ?`; - database.pool.query(query, [params.recipient], (error, result) => { + + this.clientId = params.clientId; + this.companyId = params.companyId; + this.token = params.token; + + database.pool.query(query, [params.clientId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); Object.assign(this, result[0]); + cb(); }); } - - get salesPersonName() { - if (this.name) - return `
${this._.salesPersonNameText}: ${this.name}
`; - } - - get salesPersonPhone() { - if (this.phone) - return `
${this._.salesPersonPhoneText}: ${format.phone(this.phone)}
`; - } - - get salesPersonEmail() { - if (this.email) - return `
${this._.salesPersonEmailText}: ` + - `${this.email}
`; - } }; diff --git a/services/mailer/application/template/sepa-core/style.css b/services/mailer/application/template/sepa-core/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/services/mailer/package.json b/services/mailer/package.json index 12aa4a0e4..1bbf6cfdf 100644 --- a/services/mailer/package.json +++ b/services/mailer/package.json @@ -1,8 +1,8 @@ { - "name": "mailer", + "name": "vn-mailer", "version": "0.0.1", "description": "Servidor de envío de correos", - "main": "server.js", + "main": "server/server.js", "dependencies": { "body-parser": "^1.17.2", "express": "^4.15.3", diff --git a/services/mailer/server/server.js b/services/mailer/server/server.js index 818b036a6..ba63def70 100644 --- a/services/mailer/server/server.js +++ b/services/mailer/server/server.js @@ -1,10 +1,9 @@ var express = require('express'); var app = module.exports = express(); var bodyParser = require('body-parser'); -var settings = require('../application/settings.js'); +var config = require('../application/config.js'); var mail = require('../application/mail.js'); var database = require('../application/database.js'); -var auth = require('../application/auth.js'); var path = require('path'); // Body parser middleware @@ -13,16 +12,11 @@ app.use(bodyParser.urlencoded({extended: true})); app.use('/static', express.static(path.join(__dirname, '../static'))); -// Auth middleware -var requestToken = function(request, response, next) { - auth.init(request, response, next); -}; - // Load routes -app.use('/', requestToken, require('../application/router.js')); +app.use('/', require('../application/router.js')); -app.start = function() { - var listener = app.listen(settings.app().port, function() { +app.start = function(port) { + var listener = app.listen(port ? port : config.app.port, function() { var servicePath = 'http://' + listener.address().address + ':' + listener.address().port; mail.init(); database.init(); @@ -31,7 +25,7 @@ app.start = function() { let packageJson = require('../package.json'); console.log(`Web server ${packageJson.name} listening at: ${servicePath}`); - if (settings.app().debug) { + if (config.app.debug) { console.log(`${packageJson.name} service debug mode enabled`); } }); diff --git a/services/mailer/static/css/component.css b/services/mailer/static/css/component.css new file mode 100644 index 000000000..b4c018d79 --- /dev/null +++ b/services/mailer/static/css/component.css @@ -0,0 +1,221 @@ +body { + padding: 0; + margin: 0 +} + +img { + margin: 0 +} + +p { + text-align: justify +} + +.wrapper { + background-color: #EEE +} + +.container { + font-family: arial, sans-serif; + max-width: 600px; + min-width: 320px; + font-size: 16px; + margin: 0 auto; + color: #555 +} + +.title { + background-color: #95d831; + text-align: center; + padding: 35px 0 +} + +.title h1 { + font-size: 32px; + color: #333; + margin: 0 +} + +.body { + background-color:#FFF; + padding: 20px +} + +.body a { + color: #8dba25 +} + +.body h1 { + color: #999 +} + +.body h3 { + font-size: 16px +} + +.panel { + border: 1px solid #DDD; + margin-bottom: 10px; + position: relative; + padding:10px +} + +.row { + margin-bottom: 15px; + overflow: hidden +} + +.row .text { + margin-bottom: 5px +} + +.row .control { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +.row .text, .row .control { + overflow: hidden +} + +.row .description { + position: relative; + padding-top: 2px; + overflow: hidden; + font-size: 11px; + display: block; + color: #999 +} + +.row .line { + border-bottom: 1px solid #DDD; + border-right: 1px solid #DDD; + border-left: 1px solid #DDD; + margin-top: 10px; + color: #999; + padding: 5px +} + +.row .description span { + background-color: #FFF; + margin: -5px 0 0 50px; + display: block; + padding: 5px; + float: left +} + +.row:last-child { + margin-bottom: 0 +} + +.row.inline .text { + margin-bottom: 0; + width: 40%; + float: left +} + +.row.inline .control { + font-weight: bold; + padding-left: 20px; + color: #000; + width: 60%; + float: left +} + +.row.inline .description { + position: static; + overflow: visible +} + +.box { + border-top: 1px solid #CCC; + border-right: 1px solid #CCC; + border-bottom: 1px solid #CCC; + font-weight: bold; + text-align: center; + padding-top: 4px; + width: 25px; + height: 21px; + color: #000; + float: left +} + +.box.crossed { + font-weight: 100; + font-size: 16px +} + +.row .control .box:first-child { + border-left: 1px solid #CCC; +} + +.font.small { + font-size: 10px +} + +.font.verticalAlign { + height: 27px; + line-height: 27px +} + +.font.centered { + height: 27px; + line-height: 27px; + text-align: center +} + +.verticalText { + -moz-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + position: absolute; + text-align: center; + font-size: .65em; + width: 200px; + right: -115px; + top: 50% +} + +.attachment { + overflow: hidden; + margin-top: 10px +} + +.attachment-icon { + float: left +} + +.attachment span { + padding: 16px 0 0 10px; + float: left +} + +.columns { + overflow: hidden +} + +.columns .size100 { + width: 100%; + float: left +} + +.columns .size75 { + width: 75%; + float: left +} + +.columns .size50 { + width: 50%; + float: left +} + +.columns .size33 { + width: 33.33%; + float: left +} + +.columns .size25 { + width: 25%; + float: left +} \ No newline at end of file diff --git a/services/nginx/.gitignore b/services/nginx/.gitignore index 4a76957db..c68eb0b10 100644 --- a/services/nginx/.gitignore +++ b/services/nginx/.gitignore @@ -1,4 +1,3 @@ -logs/* static/* temp/* !static/templates diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index 178fc0fba..414b3a7ef 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -1,17 +1,13 @@ FROM nginx RUN rm /etc/nginx/nginx.conf - RUN rm /etc/nginx/conf.d/default.conf -COPY conf-prod.conf /etc/nginx/nginx.conf - +COPY temp/nginx.conf /etc/nginx/nginx.conf COPY static /usr/share/nginx/html RUN apt-get update && apt-get -y install vim dnsmasq dnsutils - RUN rm -fr /usr/share/dns - RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d/dnsmasq.conf CMD service dnsmasq restart && nginx -g "daemon off;" diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf deleted file mode 100644 index 32d749780..000000000 --- a/services/nginx/conf-prod.conf +++ /dev/null @@ -1,46 +0,0 @@ - -worker_processes 1; - -events { - worker_connections 1024; -} - -http { - sendfile on; - gzip on; - default_type application/octet-stream; - resolver 127.0.0.1; - include /etc/nginx/mime.types; - - server { - listen 80; - server_name localhost; - autoindex off; - - root /usr/share/nginx/html; - - location ~ ^/static(?:/(.*))?$ { - alias /usr/share/nginx/html/$1; - autoindex on; - } - location ~ ^/auth(?:/(.*))?$ { - proxy_pass http://auth:3000/$1$is_args$args; - } - location ~ ^/client(?:/(.*))?$ { - proxy_pass http://client:3002/$1$is_args$args; - } - location ~ ^/mailer(?:/(.*))?$ { - proxy_pass http://mailer:3003/$1$is_args$args; - } - location ~ ^/production(?:/(.*))?$ { - proxy_pass http://production:3004/$1$is_args$args; - } - location ~ ^/route(?:/(.*))?$ { - proxy_pass http://route:3005/$1$is_args$args; - } - # Este tiene que ser el último - location ~ ^(?:/(.*))?$ { - proxy_pass http://salix:3001/$1$is_args$args; - } - } -} diff --git a/services/nginx/config.production.yml b/services/nginx/config.production.yml new file mode 100644 index 000000000..80792e8a0 --- /dev/null +++ b/services/nginx/config.production.yml @@ -0,0 +1,2 @@ +host: salix +port: 80 \ No newline at end of file diff --git a/services/nginx/config.test.yml b/services/nginx/config.test.yml new file mode 100644 index 000000000..3852100af --- /dev/null +++ b/services/nginx/config.test.yml @@ -0,0 +1,2 @@ +host: test-salix +port: 80 \ No newline at end of file diff --git a/services/nginx/config.yml b/services/nginx/config.yml new file mode 100644 index 000000000..6783c674d --- /dev/null +++ b/services/nginx/config.yml @@ -0,0 +1,5 @@ +host: localhost +port: 5000 +main: salix +defaultPort: 3000 +devServerPort: 8081 \ No newline at end of file diff --git a/services/nginx/conf-dev.conf b/services/nginx/nginx.development.mst similarity index 59% rename from services/nginx/conf-dev.conf rename to services/nginx/nginx.development.mst index e36a5a82a..25faeddfd 100644 --- a/services/nginx/conf-dev.conf +++ b/services/nginx/nginx.development.mst @@ -21,38 +21,28 @@ http { scgi_temp_path temp/scgi; server { - listen 5000; - server_name localhost; + listen {{port}}; + server_name {{host}}; autoindex off; + {{#services}} + location ~ ^/{{name}}(?:/(.*))?$ { + proxy_pass http://127.0.0.1:{{port}}/$1$is_args$args; + } + {{/services}} + location ~ ^/static(?:/(.*))?$ { - proxy_pass http://127.0.0.1:8081/$1$is_args$args; + proxy_pass http://127.0.0.1:{{devServerPort}}/$1$is_args$args; } - location ~ ^/auth(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3000/$1$is_args$args; - } - location ~ ^/client(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3002/$1$is_args$args; - } - location ~ ^/mailer(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3003/$1$is_args$args; - } - location ~ ^/production(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3004/$1$is_args$args; - } - location ~ ^/route(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3005/$1$is_args$args; - } - # Este tiene que ser el último location ~ ^(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3001/$1$is_args$args; + proxy_pass http://127.0.0.1:{{defaultPort}}/$1$is_args$args; } } types { text/html html; application/json json; - application/javascript js; + application/javascript js; text/css css scss; text/xml xml; image/x-icon ico; diff --git a/services/nginx/nginx.mst b/services/nginx/nginx.mst new file mode 100644 index 000000000..146fd25d8 --- /dev/null +++ b/services/nginx/nginx.mst @@ -0,0 +1,36 @@ + +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + sendfile on; + gzip on; + default_type application/octet-stream; + resolver 127.0.0.1; + include /etc/nginx/mime.types; + + server { + listen {{port}}; + server_name {{host}}; + autoindex off; + + root /usr/share/nginx/html; + + {{#services}} + location ~ ^/{{name}}(?:/(.*))?$ { + proxy_pass http://{{name}}:{{port}}/$1$is_args$args; + } + {{/services}} + + location ~ ^/static(?:/(.*))?$ { + alias /usr/share/nginx/html/$1; + autoindex on; + } + location ~ ^(?:/(.*))?$ { + proxy_pass http://{{defaultService}}:{{defaultPort}}/$1$is_args$args; + } + } +} diff --git a/services/nginx/static/images/icon_item.png b/services/nginx/static/images/icon_item.png new file mode 100644 index 000000000..ff660fb23 Binary files /dev/null and b/services/nginx/static/images/icon_item.png differ diff --git a/services/nginx/static/images/no-image200x200.png b/services/nginx/static/images/no-image200x200.png new file mode 100644 index 000000000..11d5317a9 Binary files /dev/null and b/services/nginx/static/images/no-image200x200.png differ diff --git a/services/nginx/static/templates/tooltip.locator.tpl.html b/services/nginx/static/templates/tooltip.locator.tpl.html index 214d3342b..be0877ab8 100644 --- a/services/nginx/static/templates/tooltip.locator.tpl.html +++ b/services/nginx/static/templates/tooltip.locator.tpl.html @@ -1,9 +1,9 @@ - Población - Provincia - ID_Cliente - Trabajador + Town + Province + Client ID + Worker {{::ticket.city | ucwords}} diff --git a/services/nginx/static/templates/tooltip.routes.tpl.html b/services/nginx/static/templates/tooltip.routes.tpl.html index 2ca5181cb..71e8be8d0 100644 --- a/services/nginx/static/templates/tooltip.routes.tpl.html +++ b/services/nginx/static/templates/tooltip.routes.tpl.html @@ -1,14 +1,14 @@ - - Población - Provincia - ID_Cliente - Comercial - - - {{::ticket.city | ucwords}} - {{::ticket.province | ucwords}} - {{::ticket.client | ucwords}} - {{::ticket.worker | ucwords}} - - \ No newline at end of file + + Población + Provincia + ID_Cliente + Comercial + + + {{::ticket.city | ucwords}} + {{::ticket.province | ucwords}} + {{::ticket.client | ucwords}} + {{::ticket.worker | ucwords}} + + \ No newline at end of file diff --git a/services/print/.gitignore b/services/print/.gitignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/services/print/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/services/print/application/auth.js b/services/print/application/auth.js new file mode 100644 index 000000000..ee8f114e1 --- /dev/null +++ b/services/print/application/auth.js @@ -0,0 +1,62 @@ +var database = require('./database.js'); + +module.exports = { + +/** + * Initialize auth + * @param {Object} request - Request object + * @param {Object} response - Response object + * @param {Object} next - Next object + */ + init: function(request, response, next) { + this.request = request; + this.response = response; + this.next = next; + + this.validateToken(); + }, + +/** + * Validate auth token + */ + validateToken: function() { + let query = 'SELECT userId, ttl, created FROM salix.AccessToken WHERE id = ?'; + + database.pool.query(query, [this.getToken()], (error, result) => { + let token = result[0]; + + if (error || result.length == 0) + return this.response.status(401).send({message: 'Invalid token'}); + + if (this.isTokenExpired(token.created, token.ttl)) + return this.response.status(401).send({message: 'Token expired'}); + + this.request.userId = token.userId; + this.next(); + }); + }, + +/** + * Get request token + * @return {String} Token + */ + getToken: function() { + return this.request.headers.authorization || this.request.query.token; + }, + +/** + * Checks if the token has expired + * @param {String} created - Creation date + * @param {Integer} ttl - Ttl seconds + * @return {Boolean} True if the token has expired + */ + isTokenExpired: function(created, ttl) { + let date = new Date(created); + let currentDate = new Date(); + + date.setSeconds(date.getSeconds() + ttl); + + if (currentDate > date) + return true; + } +}; diff --git a/services/print/application/config.js b/services/print/application/config.js new file mode 100644 index 000000000..335441531 --- /dev/null +++ b/services/print/application/config.js @@ -0,0 +1,21 @@ +require('require-yaml'); +var fs = require('fs-extra'); + +let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; + +let config = require(`${__dirname}/config/datasources.json`); +let configEnvFile = `${__dirname}/config/datasources.${env}.json`; + +if (fs.existsSync(configEnvFile)) + Object.assign(config, require(configEnvFile)); + +let proxyConf = require(`../../nginx/config.yml`); +let proxyEnvFile = `../../nginx/config.${env}.yml`; + +if (fs.existsSync(proxyEnvFile)) + Object.assign(proxyConf, require(proxyEnvFile)); + +config.proxy = proxyConf; +config.package = require('../package.json'); + +module.exports = config; diff --git a/services/print/application/config/datasources.json b/services/print/application/config/datasources.json new file mode 100644 index 000000000..c797136ea --- /dev/null +++ b/services/print/application/config/datasources.json @@ -0,0 +1,23 @@ +{ + "app": { + "port": 3000, + "debug": false, + "defaultLanguage": "es" + }, + "mysql": { + "host": "localhost", + "port": 3306, + "database": "vn", + "user": "root", + "password": "" + }, + "pdf": { + "format": "A4", + "header": { + "height": "120px" + }, + "footer": { + "height": "130px" + } + } +} \ No newline at end of file diff --git a/services/print/application/database.js b/services/print/application/database.js new file mode 100644 index 000000000..974540d7d --- /dev/null +++ b/services/print/application/database.js @@ -0,0 +1,24 @@ +var mysql = require('mysql'); +let config = require('./config.js'); + +module.exports = { + /** + * Pool instance + */ + pool: null, + + /** + * Start database pool + */ + init: function() { + this.pool = mysql.createPool(config.mysql); + + this.pool.getConnection(function(error, connection) { + if (error) { + throw new Error('Can\'t connect to database: ' + error.code); + } else if (config.app.debug) { + console.log('Database connection stablished'); + } + }); + } +}; diff --git a/services/print/application/locale.js b/services/print/application/locale.js new file mode 100644 index 000000000..f9737fea3 --- /dev/null +++ b/services/print/application/locale.js @@ -0,0 +1,42 @@ +var fs = require('fs'); +var config = require('./config.js'); +var path = require('path'); + +module.exports = { +/** + * Returns template locale + * @param {String} template - Template name + * @param {String} countryCode - Language code + * @param {Object} cb - Callback + */ + load: function(template, countryCode, cb) { + var localeFile = path.join(__dirname, 'template', `${template}`, 'locale', `${countryCode}.json`); + var defaultLocaleFile = path.join(__dirname, 'template', `${template}`, 'locale', `${config.app.defaultLanguage}.json`); + + fs.stat(localeFile, (error, stats) => { + if (error) { + fs.stat(defaultLocaleFile, (error, stats) => { + if (error) + return cb(new Error('Translation not found for template ' + template)); + + cb(null, {locale: require(defaultLocaleFile)}); + }); + } else { + cb(null, {locale: require(localeFile)}); + } + }); + }, + +/** + * Parse locale text + * @param {String} text - Locale text + * @param {Object} params - Locale params + * @return {String} - Returns parsed text + */ + parseText: function(text, params) { + for (var key in params) { + text = text.replace(`%${key}%`, params[key]); + } + return text; + } +}; diff --git a/services/print/application/route/manuscript.js b/services/print/application/route/manuscript.js new file mode 100644 index 000000000..091ffa4c3 --- /dev/null +++ b/services/print/application/route/manuscript.js @@ -0,0 +1,109 @@ +var express = require('express'); +var router = new express.Router(); +var template = require('../template.js'); +var config = require('../config.js'); +var pdf = require('html-pdf'); +var path = require('path'); +var auth = require('../auth.js'); + +// Auth middleware +var requestToken = function(request, response, next) { + auth.init(request, response, next); +}; + +// Sepa core +router.get('/sepa-core/:companyId/:clientId', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId + }; + + template.get('sepa-core', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + pdf.create(result.body, config.pdf).toStream(function(error, stream) { + if (error) + throw Error(error); + + response.setHeader('Content-Disposition', 'attachment; filename="sepa-core.pdf"'); + response.setHeader('Content-type', 'application/pdf'); + stream.pipe(response); + }); + }); + }); + +// Sepa core html preview +router.get('/sepa-core/:companyId/:clientId/preview', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + isPreview: true + }; + + template.get('sepa-core', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); + }); + + // Debtor letter +router.get('/letter-debtor/:companyId/:clientId', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId + }; + + template.get('letter-debtor', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + pdf.create(result.body, config.pdf).toStream(function(error, stream) { + if (error) + throw Error(error); + + response.setHeader('Content-Disposition', 'attachment; filename="extracto.pdf"'); + response.setHeader('Content-type', 'application/pdf'); + stream.pipe(response); + }); + }); + }); + + // Debtor letter html preview +router.get('/letter-debtor/:companyId/:clientId/preview', requestToken, function(request, response, next) { + let params = { + clientId: request.params.clientId, + companyId: request.params.companyId, + isPreview: true + }; + + template.get('letter-debtor', params, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + response.send(result.body); + }); + }); + + +module.exports = router; + + + // store pdf +/* router.post('/sepa-core/:clientId', function(request, response, next) { + template.get('sepa-core', {recipient: request.params.clientId}, (error, result) => { + if (error) + return response.status(400).json({message: error.message}); + + pdf.create(result.body).toFile('./tmp/test.pdf', function(error, result) { + if (error) + return response.status(400).json({message: error}); + + console.log(result); + return response.json(); + }); + }); + }); + */ \ No newline at end of file diff --git a/services/print/application/router.js b/services/print/application/router.js new file mode 100644 index 000000000..a9ebe1acf --- /dev/null +++ b/services/print/application/router.js @@ -0,0 +1,31 @@ +var express = require('express'); +var router = new express.Router(); +var fs = require('fs'); +var path = require('path'); + +// Default page +router.get('/', function(request, response) { + response.json({}); +}); + +// Manuscripts +router.use('/manuscript', require('./route/manuscript.js')); + +// Serve static images +router.use('/static/:template/:image', function(request, response) { + let imagePath = path.join(__dirname, '/template/', request.params.template, '/image/', request.params.image); + + fs.stat(imagePath, function(error) { + if (error) + return response.json({message: 'Image not found'}); + + let readStream = fs.createReadStream(imagePath); + + readStream.on('open', function() { + readStream.pipe(response); + }); + }); +}); + + +module.exports = router; diff --git a/services/print/application/template.js b/services/print/application/template.js new file mode 100644 index 000000000..9974ebcf5 --- /dev/null +++ b/services/print/application/template.js @@ -0,0 +1,184 @@ +var fs = require('fs'); +var mustache = require('mustache'); +var locale = require('./locale.js'); +var inlineCss = require('inline-css'); +var path = require('path'); + + +module.exports = { +/** + * Get template. + * @param {String} template - Template name + * @param {Object} countryCode - Language code + * @param {Object} params - Params + * @param {Object} cb - Callback + */ + get: function(template, params, cb) { + var templatePath = path.join(__dirname, 'template', `${template}`, `index.html`); + var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`); + var stylePath = path.join(__dirname, 'template', `${template}`, 'style.css'); + + fs.stat(templatePath, (error, stat) => { + if (error) + return cb(new Error('Template ' + template + ' not found')); + + let TemplateClass = require(classPath); + let instance = new TemplateClass(); + + let getRenderedStyles = (error, body) => { + if (error) + return cb(error); + + this.renderStyles(stylePath, body, (error, body) => { + if (error) + return cb(error); + + // Check if has a subject param + params.subject = params.subject || instance.subject; + + if (params.subject == undefined) { + // Try to find a subject from Html source + let title = body.match(new RegExp('(.*?)', 'i')); + + if (title) + params.subject = title[1]; + } + + this.renderImages(template, body, params.isPreview, (error, body) => { + if (error) + return cb(error); + + cb(null, {body: body}); + }); + }); + }; + + let getDataCb = () => { + this.render(templatePath, params, instance, (error, result) => getRenderedStyles(error, result)); + }; + + instance.getData(params, (error, result) => { + if (error) + return cb(error); + + locale.load(template, instance.countryCode, (error, result) => { + if (error) + return cb(error); + + instance._ = result.locale; + instance.isPreview = params.isPreview; + getDataCb(null, result); + }); + }); + }); + }, + +/** + * Render template + * @param {String} path - Template path + * @param {Object} data - Params + * @param {Object} cb - Callback + */ + render: function(path, params, data, cb) { + fs.readFile(path, 'utf8', (error, body) => { + // Find matching sub-templates + let regexp = new RegExp(/\{\{\$\.(.*?)\}\}/, 'ig'); + let subTpl = body.match(regexp); + + if (!subTpl) { + mustache.parse(body); + return cb(null, mustache.render(body, data)); + } + + let parentBody = body; + this.renderSub(parentBody, subTpl, params, regexp, (error, body) => { + if (error) + return cb(error); + + mustache.parse(body); + cb(null, mustache.render(body, data)); + }); + }); + }, + + renderSub: function(body, subTpl, params, regexp, cb) { + let index = 1; + + subTpl.forEach(keyName => { + subTplName = keyName.replace(regexp, '$1'); + + this.get(subTplName, params, (error, result) => { + if (error) + return cb(error); + + let subTplBody = result.body; + body = body.replace(keyName, subTplBody); + + if (index === subTpl.length) + cb(null, body); + + index++; + }); + + }); + }, + +/** + * Render template style. + * @param {String} path - Stylesheet path + * @param {String} body - Rendered html + * @param {Object} cb - Callback + */ + renderStyles: function(stylePath, html, cb) { + // Common components + let comPath = path.join(__dirname, '../', 'static', 'css', 'component.css'); + + fs.readFile(comPath, 'utf8', (error, comCss) => { + fs.stat(stylePath, error => { + if (error) + return cb(new Error('Template stylesheet not found')); + + fs.readFile(stylePath, 'utf8', (error, css) => { + let style = ''; + let body = style + html; + let options = {url: ' '}; + + inlineCss(body, options) + .then(function(body) { + cb(null, body); + }); + }); + }); + }); + }, + +/** + * Render template images + * @param {String} template - Template name + * @param {String} body - template body + * @param {Object} cb - Callback + */ + renderImages: function(template, body, isPreview, cb) { + let tplImages = body.match(new RegExp('src="cid:(.*?)"', 'ig')); + + if (!tplImages) + tplImages = {}; + + // Template default attachments + for (var i = 0; i < tplImages.length; i++) { + let src = tplImages[i].replace('src="cid:', '').replace('"', '').split('/'); + let attachmentTpl = src[0]; + let attachment = src[1]; + + if (isPreview) { + let imagePath = `/print/static/${attachmentTpl}/${attachment}`; + body = body.replace(tplImages[i], `src="${imagePath}"`); + } else { + let imagePath = path.join(__dirname, 'template', attachmentTpl, 'image', attachment); + body = body.replace(tplImages[i], `src="file:///${imagePath}"`); + } + } + + cb(null, body); + } +}; diff --git a/services/print/application/template/footer/footer.js b/services/print/application/template/footer/footer.js new file mode 100644 index 000000000..3b4020bf4 --- /dev/null +++ b/services/print/application/template/footer/footer.js @@ -0,0 +1,20 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class Footer { + getData(params, cb) { + let query = `SELECT + socialName + FROM client c + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } +}; diff --git a/services/print/application/template/footer/image/action.png b/services/print/application/template/footer/image/action.png new file mode 100644 index 000000000..2cd16c453 Binary files /dev/null and b/services/print/application/template/footer/image/action.png differ diff --git a/services/print/application/template/footer/image/facebook.png b/services/print/application/template/footer/image/facebook.png new file mode 100644 index 000000000..7ab54c538 Binary files /dev/null and b/services/print/application/template/footer/image/facebook.png differ diff --git a/services/print/application/template/footer/image/info.png b/services/print/application/template/footer/image/info.png new file mode 100644 index 000000000..fb75cbc4e Binary files /dev/null and b/services/print/application/template/footer/image/info.png differ diff --git a/services/print/application/template/footer/image/instagram.png b/services/print/application/template/footer/image/instagram.png new file mode 100644 index 000000000..66550c4a5 Binary files /dev/null and b/services/print/application/template/footer/image/instagram.png differ diff --git a/services/print/application/template/footer/image/linkedin.png b/services/print/application/template/footer/image/linkedin.png new file mode 100644 index 000000000..0d191e5ae Binary files /dev/null and b/services/print/application/template/footer/image/linkedin.png differ diff --git a/services/print/application/template/footer/image/pinterest.png b/services/print/application/template/footer/image/pinterest.png new file mode 100644 index 000000000..4d7b28ef8 Binary files /dev/null and b/services/print/application/template/footer/image/pinterest.png differ diff --git a/services/print/application/template/footer/image/twitter.png b/services/print/application/template/footer/image/twitter.png new file mode 100644 index 000000000..c4a8ab0c1 Binary files /dev/null and b/services/print/application/template/footer/image/twitter.png differ diff --git a/services/print/application/template/footer/image/youtube.png b/services/print/application/template/footer/image/youtube.png new file mode 100644 index 000000000..11871deb5 Binary files /dev/null and b/services/print/application/template/footer/image/youtube.png differ diff --git a/services/print/application/template/footer/index.html b/services/print/application/template/footer/index.html new file mode 100644 index 000000000..59b90b480 --- /dev/null +++ b/services/print/application/template/footer/index.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/services/print/application/template/footer/locale/es.json b/services/print/application/template/footer/locale/es.json new file mode 100644 index 000000000..04a61fddd --- /dev/null +++ b/services/print/application/template/footer/locale/es.json @@ -0,0 +1,4 @@ +{ + "phytosanitary": "VERDNATURA LEVANTE SL - Pasaporte Fitosanitario R.P. Generalitat Valenciana - Nº Comerciante: ES17462130", + "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." +} \ No newline at end of file diff --git a/services/print/application/template/footer/style.css b/services/print/application/template/footer/style.css new file mode 100644 index 000000000..aeddc6f0a --- /dev/null +++ b/services/print/application/template/footer/style.css @@ -0,0 +1,24 @@ +img { + margin: 0 +} + +#pageFooter { + font-family: arial, sans-serif; + font-weight: 100; + max-width: 90%; + margin: 0 auto; + font-size: 9px; + margin: 30px; + color: #555 +} + +#pageFooter .info { + border-bottom: 2px solid #CCC; + padding-bottom: 2px; + text-align: center; + font-size: 11px +} + +#pageFooter p { + text-align: center +} \ No newline at end of file diff --git a/services/print/application/template/header/header.js b/services/print/application/template/header/header.js new file mode 100644 index 000000000..82c78e003 --- /dev/null +++ b/services/print/application/template/header/header.js @@ -0,0 +1,20 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class Header { + getData(params, cb) { + let query = `SELECT + c.name AS clientName + FROM client c + JOIN country ct ON ct.id = c.countryFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } +}; diff --git a/services/print/application/template/header/image/logo.svg b/services/print/application/template/header/image/logo.svg new file mode 100644 index 000000000..51baf46d3 --- /dev/null +++ b/services/print/application/template/header/image/logo.svg @@ -0,0 +1,48 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/print/application/template/header/index.html b/services/print/application/template/header/index.html new file mode 100644 index 000000000..44e8e52d7 --- /dev/null +++ b/services/print/application/template/header/index.html @@ -0,0 +1,7 @@ +
+ VerdNatura +

+

{{_.mercantileRegistry}}
+
{{_.fiscalAddress}}
+

+
\ No newline at end of file diff --git a/services/print/application/template/header/locale/es.json b/services/print/application/template/header/locale/es.json new file mode 100644 index 000000000..86dbe5e58 --- /dev/null +++ b/services/print/application/template/header/locale/es.json @@ -0,0 +1,4 @@ +{ + "mercantileRegistry": "CIF: B97367486 Registro Mercantil de Valencia, Tomo 8041, Libro 5334, Folio 160, sección 8, Hoja V 102076", + "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es" +} \ No newline at end of file diff --git a/services/print/application/template/header/style.css b/services/print/application/template/header/style.css new file mode 100644 index 000000000..186ede66b --- /dev/null +++ b/services/print/application/template/header/style.css @@ -0,0 +1,16 @@ +img { + margin: 0 +} + +#pageHeader-first { + border-bottom: 1px solid #DDD; + font-family: arial, sans-serif; + padding-bottom: 10px; + text-align: center; + font-size: 10px; + color: #555 +} + +.header p { + text-align: center +} \ No newline at end of file diff --git a/services/print/application/template/letter-debtor/image/action.png b/services/print/application/template/letter-debtor/image/action.png new file mode 100644 index 000000000..2cd16c453 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/action.png differ diff --git a/services/print/application/template/letter-debtor/image/facebook.png b/services/print/application/template/letter-debtor/image/facebook.png new file mode 100644 index 000000000..7ab54c538 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/facebook.png differ diff --git a/services/print/application/template/letter-debtor/image/header.png b/services/print/application/template/letter-debtor/image/header.png new file mode 100644 index 000000000..3c063ae44 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/header.png differ diff --git a/services/print/application/template/letter-debtor/image/info.png b/services/print/application/template/letter-debtor/image/info.png new file mode 100644 index 000000000..fb75cbc4e Binary files /dev/null and b/services/print/application/template/letter-debtor/image/info.png differ diff --git a/services/print/application/template/letter-debtor/image/instagram.png b/services/print/application/template/letter-debtor/image/instagram.png new file mode 100644 index 000000000..66550c4a5 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/instagram.png differ diff --git a/services/print/application/template/letter-debtor/image/linkedin.png b/services/print/application/template/letter-debtor/image/linkedin.png new file mode 100644 index 000000000..0d191e5ae Binary files /dev/null and b/services/print/application/template/letter-debtor/image/linkedin.png differ diff --git a/services/print/application/template/letter-debtor/image/logo.png b/services/print/application/template/letter-debtor/image/logo.png new file mode 100644 index 000000000..55e26fec6 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/logo.png differ diff --git a/services/print/application/template/letter-debtor/image/logo.svg b/services/print/application/template/letter-debtor/image/logo.svg new file mode 100644 index 000000000..51baf46d3 --- /dev/null +++ b/services/print/application/template/letter-debtor/image/logo.svg @@ -0,0 +1,48 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/print/application/template/letter-debtor/image/pinterest.png b/services/print/application/template/letter-debtor/image/pinterest.png new file mode 100644 index 000000000..4d7b28ef8 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/pinterest.png differ diff --git a/services/print/application/template/letter-debtor/image/twitter.png b/services/print/application/template/letter-debtor/image/twitter.png new file mode 100644 index 000000000..c4a8ab0c1 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/twitter.png differ diff --git a/services/print/application/template/letter-debtor/image/youtube.png b/services/print/application/template/letter-debtor/image/youtube.png new file mode 100644 index 000000000..11871deb5 Binary files /dev/null and b/services/print/application/template/letter-debtor/image/youtube.png differ diff --git a/services/print/application/template/letter-debtor/index.html b/services/print/application/template/letter-debtor/index.html new file mode 100644 index 000000000..a2d92979b --- /dev/null +++ b/services/print/application/template/letter-debtor/index.html @@ -0,0 +1,84 @@ + + + + {{_.subject}} + + + + + {{$.header}} + + + +
+ +
+
+
+

EXTRACTO

+
+
CLIENTE:
+
{{clientId}}
+
+
+
FACTURA:
+
x
+
+
+
FECHA:
+
{{currentDate}}
+
+
+
+
+
+

+ {{supplierName}} +

+
+ {{supplierStreet}} +
+
+ {{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}}) +
+
+ {{supplierCountry}} +
+
+
+
+ +
+
+
Fecha
+
Concepto
+
Debe
+
Haber
+
Saldo
+
+
+
Fecha
+
Concepto
+
Debe
+
Haber
+
Saldo
+
+
+ +
+ +
+
+ Subtotal +
+
+
+ +
+ + + + {{$.footer}} + + + \ No newline at end of file diff --git a/services/print/application/template/letter-debtor/letter-debtor.js b/services/print/application/template/letter-debtor/letter-debtor.js new file mode 100644 index 000000000..77715f3b7 --- /dev/null +++ b/services/print/application/template/letter-debtor/letter-debtor.js @@ -0,0 +1,54 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class LetterDebtor { + getData(params, cb) { + let query = `SELECT + c.id clientId, + m.code mandateCode, + LOWER(ct.code) AS countryCode, + c.email AS recipient, + c.socialName AS clientName, + c.street AS clientStreet, + c.postcode AS clientPostCode, + c.city AS clientCity, + p.name AS clientProvince, + ct.country AS clientCountry, + s.name AS supplierName, + s.street AS supplierStreet, + sc.country AS supplierCountry, + s.postCode AS supplierPostCode, + s.city AS supplierCity, + sp.name AS supplierProvince + FROM client c + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN province p ON p.id = c.provinceFk + LEFT JOIN mandate m ON m.clientFk = c.id AND m.finished IS NULL + LEFT JOIN supplier s ON s.id = m.companyFk + LEFT JOIN country sc ON sc.id = s.countryFk + LEFT JOIN province sp ON sp.id = s.provinceFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } + + // Swift BIC fields + get swiftFields() { + return new Array(11); + } + + // Account number fields + get accountNumberFields() { + return new Array(23); + } + + get currentDate() { + return format.date(new Date(), '/'); + } +}; diff --git a/services/print/application/template/letter-debtor/locale/es.json b/services/print/application/template/letter-debtor/locale/es.json new file mode 100644 index 000000000..e5453e858 --- /dev/null +++ b/services/print/application/template/letter-debtor/locale/es.json @@ -0,0 +1,31 @@ +{ + "title": "Orden de domiciliación de adeudo directo SEPA CORE", + "toCompleteBySupplier": "A cumplimentar por el acreedor", + "toCompleteByClient": "A cumplimentar por el deudor", + "bodyDescription": "Mediante la firma de esta orden de domiciliación, el deudor autoriza (A) al acreedor a enviar instrucciones a la entidad del deudor para adeudar su cuenta y (B) a la entidad para efectuar los adeudos en su cuenta siguiendo las instrucciones del acreedor.Como parte de sus derechos, el deudor está legitimado al reembolso por su entidad en los términos y condiciones del contrato suscrito con la misma. La solicitud de reembolso deberá efectuarse dentro de las ocho semanas que adeudo en cuenta. Puede obtener información adicional sobre sus derechos en su entidad financiera.", + "orderReference": "Referencia de la orden de domiciliación", + "supplierIdentifier": "Identificador del acreedor", + "supplierName": "Nombre del acreedor", + "supplierStreet": "Dirección", + "supplierLocation": "CP - Población - Provincia", + "supplierCountry": "País", + "clientAdvice": "Debe llevar a su Entidad Bancaria una copia del documento firmado para que lo registre y evitar la devolución.", + "clientName": "Nombre del deudor/es", + "clientStreet": "Dirección del deudor", + "clientLocation": "CP - Población - Provincia", + "clientCountry": "País del deudor", + "swift": "Swift BIC", + "accountNumber": "Número de cuenta - IBAN", + "accountHolder": "(Titular/es de la cuenta de cargo)", + "accountNumberFormat": "En España el IBAN consta de 24 posiciones comenzando siempre por ES", + "paymentType": "Tipo de pago", + "recurrent": "Recurrente", + "unique": "Único", + "signLocation": "Fecha - Localidad", + "sign": "Firma del deudor y sello", + "mandatoryFields": "TODOS LOS CAMPOS HAN DE SER CUMPLIMENTADOS OBLIGATORIAMENTE.", + "sendOrder": "UNA VEZ FIRMADA ESTA ORDEN DE DOMICILIACIÓN DEBE SER ENVIADA AL ACREEDOR PARA SU CUSTODIA Y ES RECOMENDABLE FACILITAR UNA COPIA A SU ENTIDAD BANCARIA.", + "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es", + "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", + "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." +} \ No newline at end of file diff --git a/services/print/application/template/letter-debtor/style.css b/services/print/application/template/letter-debtor/style.css new file mode 100644 index 000000000..5b1e628d6 --- /dev/null +++ b/services/print/application/template/letter-debtor/style.css @@ -0,0 +1,22 @@ +img { + margin: 0 +} + +.body { + font-family: arial, sans-serif; + max-width: 90%; + margin: 0 auto; + font-size: 14px; + color: #000 +} + +body .title { + text-align: center; + padding-bottom: 20px +} + +body .title h1 { + font-size: 16px; + color: #333; + margin: 0 +} \ No newline at end of file diff --git a/services/print/application/template/sepa-core/index.html b/services/print/application/template/sepa-core/index.html new file mode 100644 index 000000000..92cc6fb80 --- /dev/null +++ b/services/print/application/template/sepa-core/index.html @@ -0,0 +1,128 @@ + + + + {{_.subject}} + + + + + {{$.header}} + + + +
+ + +
+

{{_.title}}

+
+ +
+
{{_.toCompleteBySupplier}}
+
+
{{_.orderReference}}
+
{{mandateCode}}
+
+
+
{{_.supplierIdentifier}}
+
ES89000B97367486
+
+
+
{{_.supplierName}}
+
{{supplierName}}
+
+
+
{{_.supplierStreet}}
+
{{supplierStreet}}
+
+
+
{{_.supplierLocation}}
+
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
+
+
+
{{_.supplierCountry}}
+
{{supplierCountry}}
+
+
+ +

{{_.bodyDescription}}

+

{{_.clientAdvice}}

+ +
+
{{_.toCompleteByClient}}
+
+
{{_.clientName}}
+
{{clientName}}
+
{{_.accountHolder}}
+
+
+
{{_.clientStreet}}
+
{{clientStreet}}
+
+
+
{{_.clientLocation}}
+
{{clientPostCode}}, {{clientCity}} ({{clientProvince}})
+
+
+
{{_.clientCountry}}
+
{{clientCountry}}
+
+
+
{{_.swift}}
+
+ {{#swiftFields}} +
+ {{/swiftFields}} +
+
+
+
{{_.accountNumber}}
+
+
ES
+ {{#accountNumberFields}} +
+ {{/accountNumberFields}} +
+
+
{{_.accountNumberFormat}}
+
+
+
+
{{_.paymentType}}
+
+
+
+
+
X
+
+
{{_.recurrent}}
+
+
O
+
+
+
+
+
{{_.unique}}
+
+
+
+
+
+
{{_.signLocation}}
+
{{currentDate}}, {{supplierProvince}}
+
+
+
{{_.sign}}
+
+
+
+

{{_.mandatoryFields}}

+

{{_.sendOrder}}

+
+ + + + {{$.footer}} + + + \ No newline at end of file diff --git a/services/print/application/template/sepa-core/locale/es.json b/services/print/application/template/sepa-core/locale/es.json new file mode 100644 index 000000000..e5453e858 --- /dev/null +++ b/services/print/application/template/sepa-core/locale/es.json @@ -0,0 +1,31 @@ +{ + "title": "Orden de domiciliación de adeudo directo SEPA CORE", + "toCompleteBySupplier": "A cumplimentar por el acreedor", + "toCompleteByClient": "A cumplimentar por el deudor", + "bodyDescription": "Mediante la firma de esta orden de domiciliación, el deudor autoriza (A) al acreedor a enviar instrucciones a la entidad del deudor para adeudar su cuenta y (B) a la entidad para efectuar los adeudos en su cuenta siguiendo las instrucciones del acreedor.Como parte de sus derechos, el deudor está legitimado al reembolso por su entidad en los términos y condiciones del contrato suscrito con la misma. La solicitud de reembolso deberá efectuarse dentro de las ocho semanas que adeudo en cuenta. Puede obtener información adicional sobre sus derechos en su entidad financiera.", + "orderReference": "Referencia de la orden de domiciliación", + "supplierIdentifier": "Identificador del acreedor", + "supplierName": "Nombre del acreedor", + "supplierStreet": "Dirección", + "supplierLocation": "CP - Población - Provincia", + "supplierCountry": "País", + "clientAdvice": "Debe llevar a su Entidad Bancaria una copia del documento firmado para que lo registre y evitar la devolución.", + "clientName": "Nombre del deudor/es", + "clientStreet": "Dirección del deudor", + "clientLocation": "CP - Población - Provincia", + "clientCountry": "País del deudor", + "swift": "Swift BIC", + "accountNumber": "Número de cuenta - IBAN", + "accountHolder": "(Titular/es de la cuenta de cargo)", + "accountNumberFormat": "En España el IBAN consta de 24 posiciones comenzando siempre por ES", + "paymentType": "Tipo de pago", + "recurrent": "Recurrente", + "unique": "Único", + "signLocation": "Fecha - Localidad", + "sign": "Firma del deudor y sello", + "mandatoryFields": "TODOS LOS CAMPOS HAN DE SER CUMPLIMENTADOS OBLIGATORIAMENTE.", + "sendOrder": "UNA VEZ FIRMADA ESTA ORDEN DE DOMICILIACIÓN DEBE SER ENVIADA AL ACREEDOR PARA SU CUSTODIA Y ES RECOMENDABLE FACILITAR UNA COPIA A SU ENTIDAD BANCARIA.", + "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es", + "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", + "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." +} \ No newline at end of file diff --git a/services/print/application/template/sepa-core/sepa-core.js b/services/print/application/template/sepa-core/sepa-core.js new file mode 100644 index 000000000..304e327da --- /dev/null +++ b/services/print/application/template/sepa-core/sepa-core.js @@ -0,0 +1,54 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); + +module.exports = class SepaCore { + getData(params, cb) { + let query = `SELECT + c.id clientId, + m.code mandateCode, + LOWER(ct.code) AS countryCode, + c.email AS recipient, + c.socialName AS clientName, + c.street AS clientStreet, + c.postcode AS clientPostCode, + c.city AS clientCity, + p.name AS clientProvince, + ct.country AS clientCountry, + s.name AS supplierName, + s.street AS supplierStreet, + sc.country AS supplierCountry, + s.postCode AS supplierPostCode, + s.city AS supplierCity, + sp.name AS supplierProvince + FROM client c + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN province p ON p.id = c.provinceFk + LEFT JOIN mandate m ON m.clientFk = c.id AND m.finished IS NULL + LEFT JOIN supplier s ON s.id = m.companyFk + LEFT JOIN country sc ON sc.id = s.countryFk + LEFT JOIN province sp ON sp.id = s.provinceFk + WHERE c.id = ?`; + database.pool.query(query, [params.clientId], (error, result) => { + if (error || result.length == 0) + return cb(new Error('No template data found')); + + Object.assign(this, result[0]); + cb(); + }); + } + + // Swift BIC fields + get swiftFields() { + return new Array(11); + } + + // Account number fields + get accountNumberFields() { + return new Array(23); + } + + get currentDate() { + return format.date(new Date(), '/'); + } +}; diff --git a/services/print/application/template/sepa-core/style.css b/services/print/application/template/sepa-core/style.css new file mode 100644 index 000000000..5b1e628d6 --- /dev/null +++ b/services/print/application/template/sepa-core/style.css @@ -0,0 +1,22 @@ +img { + margin: 0 +} + +.body { + font-family: arial, sans-serif; + max-width: 90%; + margin: 0 auto; + font-size: 14px; + color: #000 +} + +body .title { + text-align: center; + padding-bottom: 20px +} + +body .title h1 { + font-size: 16px; + color: #333; + margin: 0 +} \ No newline at end of file diff --git a/services/print/application/util/format.js b/services/print/application/util/format.js new file mode 100644 index 000000000..f05f53e57 --- /dev/null +++ b/services/print/application/util/format.js @@ -0,0 +1,59 @@ +let database = require('../database.js'); + +module.exports = { + + /** + * Devuelve el iban + * @param {String} addressNumber - Dirección de cuenta bancaria + * @param {Object} cb - Callback + */ + accountAddressIban: function(addressNumber, cb) { + database.pool.query('SELECT vn2008.cc_to_iban(?) AS iban', [addressNumber], function(error, result) { + cb(result[0].iban); + }); + }, + + /** + * Obtiene el numero de cuenta completo incluyendo iban + * @param {String} addressNumber - Dirección de cuenta bancaria + * @return {String} Cuenta bancaria formateada + */ + accountAddress: function(addressNumber) { + var formattedAccountAddress = addressNumber.replace(/(.{4})/g, '$1-'); + return formattedAccountAddress.substring(0, formattedAccountAddress.length - 1); + }, + + /** + * Devuelve el numero de cuenta mostrando únicamente los últimos 4 dígitos. + * @param {String} addressNumber - Dirección de cuenta bancaria + * @return {String} Cuenta bancaria formateada + */ + partialAccountAddress: function(addressNumber) { + let address = this.accountAddress(addressNumber); + return address.substring(0, 19).replace(/[0-9]/g, 'X') + address.substring(19, 24); + }, + + phone: function(number) { + return number; + }, + +/** + * Format date dd-mm-yyyy + * @param {Object} date - Date object + * @param {String} delimiter - Date delimiter + * @return {String} Formatted date + */ + date: function(date, delimiter = '-') { + let day = date.getDate(); + let month = date.getMonth() + 1; + let year = date.getFullYear(); + + if (day < 10) + day = `0${day}` + + if (month < 10) + month = `0${month}` + + return day + delimiter + month + delimiter + year; + } +}; diff --git a/services/print/application/util/system.js b/services/print/application/util/system.js new file mode 100644 index 000000000..358346184 --- /dev/null +++ b/services/print/application/util/system.js @@ -0,0 +1,10 @@ +module.exports = { + /** + * Obtiene las variables de entorno + * @param {String} env - Nombre de la variable de entorno + * @return {String} Valor de la variable de entorno + */ + getEnv: function(env) { + return process.env[env]; + } +}; diff --git a/services/print/package.json b/services/print/package.json new file mode 100644 index 000000000..d63a8fe34 --- /dev/null +++ b/services/print/package.json @@ -0,0 +1,20 @@ +{ + "name": "vn-print", + "version": "0.0.1", + "description": "Servidor de impresión PDF", + "main": "server/server.js", + "dependencies": { + "body-parser": "^1.17.2", + "express": "^4.15.3", + "html-pdf": "^2.2.0", + "inline-css": "^2.2.2", + "mustache": "^2.3.0", + "mysql": "^2.13.0", + "path": "^0.12.7" + }, + "repository": { + "type": "git", + "url": "https://git.verdnatura.es/salix" + }, + "license": "GPL-3.0" +} diff --git a/services/print/server/server.js b/services/print/server/server.js new file mode 100644 index 000000000..962ffdacc --- /dev/null +++ b/services/print/server/server.js @@ -0,0 +1,31 @@ +var express = require('express'); +var app = module.exports = express(); +var bodyParser = require('body-parser'); +var config = require('../application/config.js'); +var database = require('../application/database.js'); + +// Body parser middleware +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({extended: true})); + +// Load routes +app.use('/', require('../application/router.js')); + +app.start = function(port) { + var listener = app.listen(port ? port : config.app.port, function() { + var servicePath = 'http://' + listener.address().address + ':' + listener.address().port; + database.init(); + + let packageJson = require('../package.json'); + console.log(`Web server ${packageJson.name} listening at: ${servicePath}`); + + if (config.app.debug) { + console.log(`${packageJson.name} service debug mode enabled`); + } + }); + return listener; +}; + +if (require.main === module) { + app.start(); +} diff --git a/services/print/static/css/component.css b/services/print/static/css/component.css new file mode 100644 index 000000000..2b2b8e157 --- /dev/null +++ b/services/print/static/css/component.css @@ -0,0 +1,203 @@ +body { + margin: 0 auto; + width: 210mm +} + +img { + margin: 0 +} + +p { + text-align: justify +} + +.panel { + border: 1px solid #DDD; + margin-bottom: 10px; + position: relative; + padding:10px +} + +.row { + margin-bottom: 15px; + overflow: hidden +} + +.row.small { + margin-bottom: 5px +} + +.row .text { + margin-bottom: 5px +} + +.row .control { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +.row .text, .row .control { + overflow: hidden +} + +.row .description { + position: relative; + padding-top: 2px; + overflow: hidden; + font-size: 9px; + display: block; + color: #999 +} + +.row .line { + border-bottom: 1px solid #DDD; + border-right: 1px solid #DDD; + border-left: 1px solid #DDD; + margin-top: 10px; + color: #999; + padding: 5px +} + +.row .description span { + background-color: #FFF; + margin: -5px 0 0 50px; + display: block; + padding: 5px; + float: left +} + +.row:last-child { + margin-bottom: 0 +} + +.row.inline .text { + margin-bottom: 0; + width: 40%; + float: left +} + +.row.inline .control { + font-weight: bold; + padding-left: 20px; + color: #000; + width: 60%; + float: left +} + +.row.inline .description { + position: static; + overflow: visible +} + +.box { + border-top: 1px solid #CCC; + border-right: 1px solid #CCC; + border-bottom: 1px solid #CCC; + font-weight: bold; + text-align: center; + padding-top: 4px; + width: 25px; + height: 21px; + color: #000; + float: left +} + +.box.crossed { + font-weight: 100; + font-size: 16px +} + +.row .control .box:first-child { + border-left: 1px solid #CCC; +} + +.font.small { + font-size: 10px +} + +.font.gray { + color: #555 +} + +.font.verticalAlign { + height: 27px; + line-height: 27px +} + +.font.centered { + height: 27px; + line-height: 27px; + text-align: center +} + +.verticalText { + -moz-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); + position: absolute; + text-align: center; + font-size: .65em; + width: 200px; + right: -115px; + top: 50% +} + +.columns { + overflow: hidden +} + +.columns .size100 { + width: 100%; + float: left +} + +.columns .size75 { + width: 75%; + float: left +} + +.columns .size50 { + width: 50%; + float: left +} + +.columns .size33 { + width: 33.33%; + float: left +} + +.columns .size25 { + width: 25%; + float: left +} + +.pull-left { + float: left +} + +.pull-right { + float: right +} + + +.grid { + border-bottom: 3px solid #888888 +} + +.grid .row { + padding: 5px; + margin-bottom: 0 +} + +.grid .header { + border-bottom: 1px solid #808080; + border-top: 1px solid #808080; + background-color: #c0c0c0; +} + + +.grid .row.inline > div { + float: left; +} + diff --git a/services/production/Dockerfile b/services/production/Dockerfile deleted file mode 100644 index 7c0658d7c..000000000 --- a/services/production/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:6.9.1 - -COPY production /app - -COPY loopback /loopback - -WORKDIR /app - -RUN npm install - -RUN npm -g install pm2 - -CMD ["pm2-docker", "./server/server.js"] - -EXPOSE 3004 diff --git a/services/production/README.md b/services/production/README.md deleted file mode 100644 index 866baed5e..000000000 --- a/services/production/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# My Application - -The project is generated by [LoopBack](http://loopback.io). \ No newline at end of file diff --git a/services/production/common/methods/fake-production/list.js b/services/production/common/methods/fake-production/list.js index a52f29f96..cfbad9651 100644 --- a/services/production/common/methods/fake-production/list.js +++ b/services/production/common/methods/fake-production/list.js @@ -3,10 +3,10 @@ module.exports = function(Self) { Self.list = function(ctx, filter, callback) { let daysTickets = 0; - let warehouseFk = filter.where.warehouseFk; + let warehouseFk = filter.warehouseFk; delete filter.limit; delete filter.page; - delete filter.where.warehouseFk; + delete filter.warehouseFk; let call = `call salix.production_control_source(? , ?)`; var params = [warehouseFk, daysTickets]; @@ -25,17 +25,19 @@ module.exports = function(Self) { onFinish(err); } - reBuildFilter(); + buildWhereObject(); + let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where); let query = `SELECT * FROM tmp.production ${where.sql} GROUP BY RouteFk ORDER BY routeFk`; conn.query(query, where.params, onFinish); } - function reBuildFilter() { - if (filter.where && filter.where.q) { - let regexQ = new RegExp(filter.where.q); - delete filter.where.q; - let newFilter = { + function buildWhereObject() { + let newFilter = {}; + if (filter.q) { + let regexQ = new RegExp(filter.q); + delete filter.q; + newFilter = { and: [ { or: [ @@ -46,17 +48,20 @@ module.exports = function(Self) { ] }; - if (Object.keys(filter.where).length) { - Object.keys(filter.where).forEach( + if (Object.keys(filter).length) { + Object.keys(filter).forEach( key => { let field = {}; - field[key] = filter.where[key]; + field[key] = filter[key]; newFilter.and.push(field); } ); } - filter.where = newFilter; + } else if (Object.keys(filter).length) { + newFilter = filter; } + + filter.where = newFilter; } function onFinish(err, results) { diff --git a/services/production/common/methods/fake-production/message-send.js b/services/production/common/methods/fake-production/message-send.js index 67e518ba6..3552ab29b 100644 --- a/services/production/common/methods/fake-production/message-send.js +++ b/services/production/common/methods/fake-production/message-send.js @@ -3,7 +3,7 @@ module.exports = function(FakeProduction) { FakeProduction.remoteMethodCtx('messageSend', { description: 'Send message to salesPerson of one array of tickets', returns: { - arg: 'response', + arg: 'response', type: 'message' }, http: { @@ -11,13 +11,13 @@ module.exports = function(FakeProduction) { verb: 'post' } }); - + FakeProduction.messageSend = function(ctx, cb) { var tickets = ctx.req.body.tickets; var userId = ctx.req.accessToken.$userId; var User = FakeProduction.app.models.User; - - User.findById(userId, function (err, user) { + + User.findById(userId, function(err, user) { var elements = []; tickets.forEach(function(t) { elements.push({sender: user.username, salesPerson: t.salesPerson, message: `Revisa el tickete ${t.ticketFk}`}); @@ -26,7 +26,7 @@ module.exports = function(FakeProduction) { }); }; - var messageSend = function(elements, cb){ + function messageSend(elements, cb) { var messages = []; var messagesInbox = []; elements.forEach(function(e) { @@ -39,33 +39,42 @@ module.exports = function(FakeProduction) { createMessage(messages, messagesInbox, cb); } - var createMessage = function(messages, messagesInbox, cb) { + function createMessage(messages, messagesInbox, cb) { var Message = FakeProduction.app.models.Message; FakeProduction.beginTransaction({isolationLevel: FakeProduction.Transaction.READ_COMMITTED}, function(err, tx) { - Message.create(messages, {transaction: tx}, function (err, res) { - if(err){ + Message.create(messages, {transaction: tx}, function(err, res) { + if (err) { tx.rollback(function(error) { - (error) ? cb(error, null) : cb(err, null); + if (error) + cb(error, null); + else + cb(err, null); }); - } else{ + } else { createMessageInbox(messagesInbox, tx, cb); } }); }); } - var createMessageInbox = function(messagesInbox, tx, cb) { + function createMessageInbox(messagesInbox, tx, cb) { var MessageInbox = FakeProduction.app.models.MessageInbox; - MessageInbox.create(messagesInbox, {transaction: tx}, function (err, res) { - if(err){ + MessageInbox.create(messagesInbox, {transaction: tx}, function(err, res) { + if (err) { tx.rollback(function(error) { - (error) ? cb(error, null) : cb(err, null); + if (error) + cb(error, null); + else + cb(err, null); }); - } else{ + } else { tx.commit(function(err) { - (err) ? cb(err, null) : cb(null, res); + if (err) + cb(err, null); + else + cb(null, res); }); } }); } -} +}; diff --git a/services/production/common/methods/fake-production/route.js b/services/production/common/methods/fake-production/route.js index e1814e918..69a17df62 100644 --- a/services/production/common/methods/fake-production/route.js +++ b/services/production/common/methods/fake-production/route.js @@ -1,9 +1,8 @@ module.exports = function(FakeProduction) { - FakeProduction.remoteMethodCtx('routeList', { description: 'Route list', returns: { - arg: 'response', + arg: 'response', type: 'message' }, http: { @@ -24,5 +23,4 @@ module.exports = function(FakeProduction) { cb(response, null); }); }; - }; diff --git a/services/production/common/methods/ticket-state/change-state.js b/services/production/common/methods/ticket-state/change-state.js index 2be312534..8bdc6ffd5 100644 --- a/services/production/common/methods/ticket-state/change-state.js +++ b/services/production/common/methods/ticket-state/change-state.js @@ -1,5 +1,5 @@ -module.exports = function(TicketState) { - TicketState.remoteMethodCtx('changeState', { +module.exports = function(Self) { + Self.remoteMethodCtx('changeState', { description: 'Change state of tickets', accepts: [ { @@ -8,10 +8,10 @@ module.exports = function(TicketState) { required: true, description: 'New state', http: {source: 'path'} - }, + } ], returns: { - arg: 'response', + arg: 'response', type: 'boolean' }, http: { @@ -19,38 +19,38 @@ module.exports = function(TicketState) { path: '/:state/changeState' } }); - - TicketState.changeState = function(ctx, state, cb) { + + Self.changeState = function(ctx, state, cb) { var tickets = ctx.req.body.tickets; - TicketState.connectToService(ctx, "client"); - - TicketState.app.models.Employee.findOne({where: {userFk: ctx.req.accessToken.userId}}, function(err, emp){ - if(!err) - changeState(emp.id, tickets, state, cb); - else + Self.connectToService(ctx, "client"); + + Self.app.models.Worker.findOne({where: {userFk: ctx.req.accessToken.userId}}, function(err, emp) { + if (err) cb(err, null); + else + changeState(emp.id, tickets, state, cb); }); - TicketState.disconnectFromService("client"); + Self.disconnectFromService("client"); }; - var changeState = function(emp, tickets, state, cb){ - var inserts = []; - var FakeProduction = TicketState.app.models.FakeProduction; + function changeState(emp, tickets, state, cb) { + var inserts = []; + var FakeProduction = Self.app.models.FakeProduction; tickets.forEach(function(t) { - inserts.push({ticketFk: t, stateFk: state, employeeFk: emp}); + inserts.push({ticketFk: t, stateFk: state, workerFk: emp}); }, this); - TicketState.create(inserts, function(err, res){ - if(err) - cb(err, null) - else{ - FakeProduction.updateAll({ticketFk: {inq: tickets}}, {stateFk: state}, function(err, info){ - (err) ? cb(err, null) : cb(null, info); + Self.create(inserts, function(err, res) { + if (err) + cb(err, null); + else { + FakeProduction.updateAll({ticketFk: {inq: tickets}}, {stateFk: state}, function(err, info) { + cb(err, info); }); } }); } -} \ No newline at end of file +}; diff --git a/services/production/common/methods/ticket/change-time.js b/services/production/common/methods/ticket/change-time.js index 3f6f13c4a..497700b2c 100644 --- a/services/production/common/methods/ticket/change-time.js +++ b/services/production/common/methods/ticket/change-time.js @@ -9,7 +9,7 @@ module.exports = function(Ticket) { http: {source: 'path'} }], returns: { - arg: 'response', + arg: 'response', type: 'boolean' }, http: { @@ -25,7 +25,7 @@ module.exports = function(Ticket) { var query = `update Ticket set date = CONCAT(DATE(date), ' ', ?) where id in (?)`; var params = [hour, tickets]; - FakeProduction.updateAll({ticketFk: {inq: tickets}}, {hour: hour}, function(err, res){ + FakeProduction.updateAll({ticketFk: {inq: tickets}}, {hour: hour}, function(err, res) { if (err) cb(err, null); else diff --git a/services/production/common/methods/ticket/change-worker.js b/services/production/common/methods/ticket/change-worker.js index c1fcea080..896c8a7f9 100644 --- a/services/production/common/methods/ticket/change-worker.js +++ b/services/production/common/methods/ticket/change-worker.js @@ -1,5 +1,5 @@ -module.exports = function(Ticket) { - Ticket.remoteMethodCtx('changeWorker', { +module.exports = function(Self) { + Self.remoteMethodCtx('changeWorker', { description: 'Change worker of tickets state', accepts: [ { @@ -11,7 +11,7 @@ module.exports = function(Ticket) { } ], returns: { - arg: 'response', + arg: 'response', type: 'boolean' }, http: { @@ -19,17 +19,29 @@ module.exports = function(Ticket) { path: '/:worker/changeWorker' } }); - - Ticket.changeWorker = function(ctx, worker, cb) { - var tickets = ctx.req.body.tickets; + + Self.changeWorker = function(ctx, worker, cb) { + let tickets = ctx.req.body.tickets; changeWorker(worker, tickets, cb); }; - let changeWorker = function(worker, tickets, cb) { - var FakeProduction = Ticket.app.models.FakeProduction; - - FakeProduction.updateAll({ticketFk: {inq: tickets}}, {workerFk: worker}, function(err, info){ - (err) ? cb(err, null) : cb(null, info); + function changeWorker(worker, tickets, cb) { + let ticketTracking = Self.app.models.ticketTracking; + let toSave = []; + for (let ticket of tickets) { + toSave.push( + { + stateFk: 20, + ticketFk: ticket, + workerFk: worker + } + ); + } + ticketTracking.create(toSave, function(err, info) { + if (err) + cb(err, null); + else + cb(null, info); }); - }; + } }; diff --git a/services/production/common/methods/ticket/list.js b/services/production/common/methods/ticket/list.js index 0268c6186..371acf653 100644 --- a/services/production/common/methods/ticket/list.js +++ b/services/production/common/methods/ticket/list.js @@ -9,7 +9,7 @@ module.exports = function(Ticket) { http: {source: 'path'} },*/ returns: { - arg: 'tickets', + arg: 'tickets', type: 'object' }, http: { @@ -17,16 +17,16 @@ module.exports = function(Ticket) { path: '/list' } }); - + Ticket.list = function(cb) { // list(); }; - var list = function(){ + function list() { var params = [1, 0]; var query = 'CALL production_control_source(?, ?)'; - + var cb = function(error, res) { if (error) console.log(error); else console.log(res); diff --git a/services/production/common/models/client.json b/services/production/common/models/client.json deleted file mode 100644 index c20e82e6c..000000000 --- a/services/production/common/models/client.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "Client", - "base": "VnModel", - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "name": { - "type": "string", - "required": true - } - } -} \ No newline at end of file diff --git a/services/production/common/models/message-inbox.json b/services/production/common/models/message-inbox.json index 851e04af8..08839a9ac 100644 --- a/services/production/common/models/message-inbox.json +++ b/services/production/common/models/message-inbox.json @@ -1,6 +1,11 @@ { "name": "MessageInbox", "base": "VnModel", + "options": { + "mysql": { + "table": "messageInbox" + } + }, "properties": { "id": { "type": "Number", diff --git a/services/production/common/models/message.json b/services/production/common/models/message.json index 249aa3795..25c4e761c 100644 --- a/services/production/common/models/message.json +++ b/services/production/common/models/message.json @@ -1,6 +1,11 @@ { "name": "Message", "base": "VnModel", + "options": { + "mysql": { + "table": "message" + } + }, "properties": { "id": { "type": "Number", diff --git a/services/production/common/models/route.json b/services/production/common/models/route.json index ddc34ac07..1bfddd3de 100644 --- a/services/production/common/models/route.json +++ b/services/production/common/models/route.json @@ -1,6 +1,11 @@ { "name": "Route", "base": "VnModel", + "options": { + "mysql": { + "table": "route" + } + }, "properties": { "id": { "type": "Number", @@ -10,7 +15,5 @@ "date": { "type": "date" } - }, - "validations": [], - "methods": {} + } } \ No newline at end of file diff --git a/services/production/common/models/state.json b/services/production/common/models/state.json index 83de332b5..f69969688 100644 --- a/services/production/common/models/state.json +++ b/services/production/common/models/state.json @@ -1,6 +1,11 @@ { "name": "State", "base": "VnModel", + "options": { + "mysql": { + "table": "state" + } + }, "properties": { "id": { "id": true, diff --git a/services/production/common/models/ticket-state.js b/services/production/common/models/ticket-state.js index 4c320c203..2580d98db 100644 --- a/services/production/common/models/ticket-state.js +++ b/services/production/common/models/ticket-state.js @@ -1,4 +1,4 @@ module.exports = function(Self) { require('../methods/ticket-state/change-state.js')(Self); -}; \ No newline at end of file +}; diff --git a/services/production/common/models/ticket-state.json b/services/production/common/models/ticket-state.json index 2fb5270d8..693dc7b87 100644 --- a/services/production/common/models/ticket-state.json +++ b/services/production/common/models/ticket-state.json @@ -1,6 +1,11 @@ { "name": "TicketState", "base": "VnModel", + "options": { + "mysql": { + "table": "ticketState" + } + }, "properties": { "id": { "id": true, @@ -23,10 +28,10 @@ "model": "State", "foreignKey": "stateFk" }, - "employee": { + "worker": { "type": "belongsTo", - "model": "Employee", - "foreignKey": "employeeFk" + "model": "Worder", + "foreignKey": "workerFk" } } } diff --git a/services/production/common/models/ticket-tracking.json b/services/production/common/models/ticket-tracking.json new file mode 100644 index 000000000..ce7ea659a --- /dev/null +++ b/services/production/common/models/ticket-tracking.json @@ -0,0 +1,38 @@ +{ + "name": "TicketTracking", + "base": "VnModel", + "options": { + "mysql": { + "table": "ticketTracking" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "created": { + "type": "Date", + "required": false + } + }, + "relations": { + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" + }, + "state": { + "type": "belongsTo", + "model": "State", + "foreignKey": "stateFk" + }, + "worker": { + "type": "belongsTo", + "model": "worker", + "foreignKey": "workerFk" + } + } + } + \ No newline at end of file diff --git a/services/production/common/models/ticket.json b/services/production/common/models/ticket.json index c9c77d34d..4bfdc34d6 100644 --- a/services/production/common/models/ticket.json +++ b/services/production/common/models/ticket.json @@ -1,13 +1,18 @@ { "name": "Ticket", "base": "VnModel", + "options": { + "mysql": { + "table": "ticket" + } + }, "properties": { "id": { "id": true, "type": "Number", "forceId": false }, - "date": { + "shipped": { "type": "date" } } diff --git a/services/production/common/sql/FakeProduction.sql b/services/production/common/sql/FakeProduction.sql deleted file mode 100644 index fcf9ad856..000000000 --- a/services/production/common/sql/FakeProduction.sql +++ /dev/null @@ -1,42 +0,0 @@ -select tmp.Id_Ticket as ticketFk, -tmp.Id_Cliente as clientFk, -tmp.Alias as client, -tmp.Fecha as `date`, -tmp.Hora as hour, -tmp.POBLACION as city, -tmp.PROVINCIA as province, -tmp.province_id as provinceFk, -tmp.Agencia as agency, -tmp.agency_id as agencyFk, -tmp.lines, -tmp.m3, -tmp.problems, -tmp.problem, -tmp.state as stateFk, -t.Id_Trabajador as workerfk, -concat(t.Nombre, ' ', t.Apellidos) as worker, -tt.Id_Trabajador as salesPersonFk, -concat(tt.Nombre, ' ', tt.Apellidos) as salesPerson, -s.name as state, -tmp.Cajas as boxes, -tmp.Id_Ruta as routeFk -from tmp.production_buffer tmp -inner join state s -on tmp.state = s.id -inner join Trabajadores t -on tmp.CodigoTrabajador = t.CodigoTrabajador collate utf8_unicode_ci -inner join Trabajadores tt -on tmp.Comercial = tt.CodigoTrabajador collate utf8_unicode_ci; - -ALTER TABLE `salix`.`FakeProduction` -CHANGE COLUMN `client` `client` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `hour` `hour` TIME NULL DEFAULT NULL , -CHANGE COLUMN `city` `city` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `province` `province` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `agency` `agency` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `problem` `problem` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `worker` `worker` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `salesPerson` `salesPerson` VARCHAR(50) NULL DEFAULT NULL , -CHANGE COLUMN `state` `state` VARCHAR(50) NULL DEFAULT NULL ; - -update salix.FakeProduction set problem = null where problem like '% %'; \ No newline at end of file diff --git a/services/production/server/config.json b/services/production/server/config.json deleted file mode 100644 index 9b3ae9752..000000000 --- a/services/production/server/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "port": 3004 -} diff --git a/services/production/server/model-config.json b/services/production/server/model-config.json index 5ecf23cfe..f06d6f57d 100644 --- a/services/production/server/model-config.json +++ b/services/production/server/model-config.json @@ -1,53 +1,4 @@ { - "user": { - "dataSource": "auth" - }, - "AccessToken": { - "dataSource": "auth", - "relations": { - "user": { - "type": "belongsTo", - "model": "user", - "foreignKey": "userId" - } - } - }, - "ACL": { - "dataSource": "auth" - }, - "RoleMapping": { - "dataSource": "auth" - }, - "Role": { - "dataSource": "auth" - }, - "Account": { - "dataSource": "auth" - }, - "Ticket": { - "dataSource": "vn" - }, - "State":{ - "dataSource": "vn" - }, - "TicketState":{ - "dataSource": "vn" - }, - "Warehouse":{ - "dataSource": "vn" - }, - "Employee":{ - "dataSource": "vn" - }, - "Client":{ - "dataSource": "client" - }, - "Province":{ - "dataSource": "vn" - }, - "Agency": { - "dataSource": "vn" - }, "FakeProduction": { "dataSource": "vn" }, @@ -59,6 +10,17 @@ }, "Route": { "dataSource": "vn" + }, + "State":{ + "dataSource": "vn" + }, + "Ticket": { + "dataSource": "vn" + }, + "TicketState":{ + "dataSource": "vn" + }, + "TicketTracking": { + "dataSource": "vn" } - } diff --git a/services/production/server/server.js b/services/production/server/server.js index bc4b454c4..f0493dcd9 100644 --- a/services/production/server/server.js +++ b/services/production/server/server.js @@ -1,7 +1,4 @@ var vnLoopback = require('../../loopback/server/server.js'); var app = module.exports = vnLoopback.loopback(); -vnLoopback.boot(app, __dirname); -if (require.main === module) { - app.start(); -} +vnLoopback.boot(app, __dirname, module); diff --git a/services/route/Dockerfile b/services/route/Dockerfile deleted file mode 100644 index ded1fa1db..000000000 --- a/services/route/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:6.9.1 - -COPY route /app - -COPY loopback /loopback - -WORKDIR /app - -RUN npm install - -RUN npm -g install pm2 - -CMD ["pm2-docker", "./server/server.js"] - -EXPOSE 3005 diff --git a/services/route/common/methods/comboVehicles.js b/services/route/common/methods/comboVehicles.js index aeef16bde..df3978d9f 100644 --- a/services/route/common/methods/comboVehicles.js +++ b/services/route/common/methods/comboVehicles.js @@ -1,5 +1,5 @@ -module.exports = (Vehicle) => { - Vehicle.remoteMethod('comboVehicles', { +module.exports = Self => { + Self.remoteMethod('comboVehicles', { description: 'returns list of vehicles', accessType: 'READ', accepts: [{ @@ -20,15 +20,15 @@ module.exports = (Vehicle) => { } }); - Vehicle.comboVehicles = (filter, callback) => { - Vehicle.find(filter, (_, instances) => { + Self.comboVehicles = (filter, callback) => { + Self.find(filter, (_, instances) => { callback(null, formatOutput(instances)); }); }; function formatOutput(instances) { let results = []; - + for (let instance of instances) { let numberPlate = ` ${instance.numberPlate}` || ''; results.push({ @@ -39,4 +39,4 @@ module.exports = (Vehicle) => { return results; } -}; \ No newline at end of file +}; diff --git a/services/route/common/methods/drivers.js b/services/route/common/methods/drivers.js index de51f471b..d074391fa 100644 --- a/services/route/common/methods/drivers.js +++ b/services/route/common/methods/drivers.js @@ -1,6 +1,6 @@ -module.exports = (Vehicle) => { - Vehicle.remoteMethod('activeDrivers', { - description: 'returns actives employees with driver role', +module.exports = Self => { + Self.remoteMethod('activeDrivers', { + description: 'returns actives workers with driver role', accessType: 'READ', accepts: [{ arg: 'filter', @@ -11,7 +11,7 @@ module.exports = (Vehicle) => { }], returns: { arg: 'data', - type: 'Employee', + type: 'Worker', root: true }, http: { @@ -20,20 +20,20 @@ module.exports = (Vehicle) => { } }); - Vehicle.activeDrivers = (filter, callback) => { + Self.activeDrivers = (filter, callback) => { let skip = filter.skip || 0; let limit = filter.limit || 10; let where = getCondition(filter.where); // TODO: change salesPerson role to Driver role when it will be created - let query = `SELECT em.id, em.name, em.surname - FROM Employee em - JOIN Account ac ON em.userFk = ac.id - JOIN Role ON Role.id = ac.roleFK - WHERE ac.active AND Role.\`name\`='salesPerson' ${where} - ORDER BY em.name ASC - LIMIT ${limit} OFFSET ${skip}`; - - Vehicle.rawSql(query, [], callback) + let query = `SELECT em.id, em.firstName, em.name + FROM worker em + JOIN account.user ac ON em.userFk = ac.id + JOIN account.role r ON r.id = ac.roleFK + WHERE ac.active AND r.\`name\` = 'salesPerson' ${where} + ORDER BY em.name ASC + LIMIT ${limit} OFFSET ${skip}`; + + Self.rawSql(query, [], callback) .then(response => { callback(null, formatDriver(response)); }) @@ -44,36 +44,36 @@ module.exports = (Vehicle) => { function getCondition(where) { let out = []; - if(typeof where === 'object') { - Object.keys(where).forEach((k) => { + if (typeof where === 'object') { + Object.keys(where).forEach(k => { let value = where[k]; if (typeof value === 'number') { out.push(`em.${k}=${value}`); } else if (typeof value === 'string') { out.push(`em.${k}='${value}'`); - } else if (typeof value === 'boolean' || value === null) { + } else if (typeof value === 'boolean' || value === null) { out.push(`em.${k} IS ${String(value).toUpperCase()}`); } else if (Object.keys(value).length) { let firstProperty = Object.keys(value)[0]; out.push(`em.${k} ${firstProperty} '${value[firstProperty]}'`); } else { - throw new Error ('Error: unexpected type'); + throw new Error('Error: unexpected type'); } }); } return out.length ? `AND (${out.join(' AND ')})` : ''; } - function formatDriver (response) { + function formatDriver(response) { let results = []; - response.forEach( person => { + response.forEach(person => { results.push({ id: person.id, - name: `${person.name} ${person.surname}` + name: `${person.firstName} ${person.name}` }); }); return results; } -}; \ No newline at end of file +}; diff --git a/services/route/common/methods/filterRoutes.js b/services/route/common/methods/filterRoutes.js index 47edb3dcd..8d15050dd 100644 --- a/services/route/common/methods/filterRoutes.js +++ b/services/route/common/methods/filterRoutes.js @@ -1,5 +1,5 @@ -module.exports = function(Delivery) { - Delivery.installMethod('filter', filterRoutes); +module.exports = function(Self) { + Self.installMethod('filter', filterRoutes); function filterRoutes(params) { if (params.search) diff --git a/services/route/common/models/delivery.json b/services/route/common/models/delivery.json index 36b83addb..7c3c5c621 100644 --- a/services/route/common/models/delivery.json +++ b/services/route/common/models/delivery.json @@ -1,6 +1,11 @@ { "name": "Delivery", "base": "VnModel", + "options": { + "mysql": { + "table": "delivery" + } + }, "properties": { "id": { "id": true, diff --git a/services/route/common/models/vehicle.json b/services/route/common/models/vehicle.json index b330dedb7..f25e72320 100644 --- a/services/route/common/models/vehicle.json +++ b/services/route/common/models/vehicle.json @@ -1,6 +1,11 @@ { "name": "Vehicle", "base": "VnModel", + "options": { + "mysql": { + "table": "vehicle" + } + }, "properties": { "id": { "id": true, diff --git a/services/route/common/models/zone.json b/services/route/common/models/zone.json index cc23ebda4..2398ecece 100644 --- a/services/route/common/models/zone.json +++ b/services/route/common/models/zone.json @@ -1,6 +1,11 @@ { "name": "Zone", "base": "VnModel", + "options": { + "mysql": { + "table": "zone" + } + }, "properties": { "id": { "id": true, diff --git a/services/route/server/config.json b/services/route/server/config.json deleted file mode 100644 index ceae49d8f..000000000 --- a/services/route/server/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "port": 3005 -} diff --git a/services/route/server/model-config.json b/services/route/server/model-config.json index 032bbc862..5b7a0dc34 100644 --- a/services/route/server/model-config.json +++ b/services/route/server/model-config.json @@ -1,39 +1,11 @@ { - "user": { - "dataSource": "auth" - }, - "AccessToken": { - "dataSource": "auth", - "relations": { - "user": { - "type": "belongsTo", - "model": "user", - "foreignKey": "userId" - } - } - }, - "ACL": { - "dataSource": "auth" - }, - "RoleMapping": { - "dataSource": "auth" - }, - "Role": { - "dataSource": "auth" - }, - "Account": { - "dataSource": "auth" - }, "Delivery": { "dataSource": "vn" }, - "Zone": { - "dataSource": "vn" - }, - "Agency": { - "dataSource": "vn" - }, "Vehicle": { "dataSource": "vn" + }, + "Zone": { + "dataSource": "vn" } } diff --git a/services/route/server/server.js b/services/route/server/server.js index eda31589d..030bbc1b4 100644 --- a/services/route/server/server.js +++ b/services/route/server/server.js @@ -2,7 +2,4 @@ var vnLoopback = require('../../loopback/server/server.js'); var app = module.exports = vnLoopback.loopback(); -vnLoopback.boot(app, __dirname); -if (require.main === module) { - app.start(); -} +vnLoopback.boot(app, __dirname, module); diff --git a/services/salix/Dockerfile b/services/salix/Dockerfile deleted file mode 100644 index db7b8720f..000000000 --- a/services/salix/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:6.9.1 - -COPY salix /app - -COPY loopback /loopback - -WORKDIR /app - -RUN npm install - -RUN npm -g install pm2 - -CMD ["pm2-docker", "./server/server.js"] - -EXPOSE 3001 \ No newline at end of file diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 2fd57778a..c7e5d09b3 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -41,10 +41,24 @@ module.exports = function(app) { }); }); + app.get('/validateToken', function(req, res) { + let token = req.headers.authorization; + + validateToken(token, function(isValid) { + if (isValid) { + res.json(null); + } else { + res.status(401).json({ + message: 'Invalid token' + }); + } + }); + }); + function validateToken(tokenId, cb) { models.AccessToken.findById(tokenId, function(err, token) { if (token) { - token.validate(function (err, isValid) { + token.validate(function(err, isValid) { cb(isValid === true, token); }); } else diff --git a/services/salix/server/config.json b/services/salix/server/config.json deleted file mode 100644 index ee330a0b6..000000000 --- a/services/salix/server/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "port": 3001 -} diff --git a/services/salix/server/model-config.json b/services/salix/server/model-config.json deleted file mode 100644 index 6bf586437..000000000 --- a/services/salix/server/model-config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "user": { - "dataSource": "auth" - }, - "AccessToken": { - "dataSource": "auth", - "relations": { - "user": { - "type": "belongsTo", - "model": "user", - "foreignKey": "userId" - } - } - }, - "ACL": { - "dataSource": "auth" - }, - "RoleMapping": { - "dataSource": "auth" - }, - "Role": { - "dataSource": "auth" - }, - "Account": { - "dataSource": "auth" - } -} diff --git a/services/salix/server/server.js b/services/salix/server/server.js index 4c7743f0d..0fa36395b 100644 --- a/services/salix/server/server.js +++ b/services/salix/server/server.js @@ -10,8 +10,4 @@ app.set('url auth', '/auth'); app.use(cookieParser()); -vnLoopback.boot(app, __dirname); - -if (require.main === module) { - app.start(); -} +vnLoopback.boot(app, __dirname, module); diff --git a/services/utils/jasmineHelpers.js b/services/utils/jasmineHelpers.js index 11a808d1d..fd0b82c5a 100644 --- a/services/utils/jasmineHelpers.js +++ b/services/utils/jasmineHelpers.js @@ -1,8 +1,8 @@ -export function catchErrors(done) { +module.exports.catchErrors = function(done) { return error => { if (error instanceof Error) { return done.fail(error.stack); } return done.fail(JSON.stringify(error)); }; -} +}; diff --git a/services_tests.js b/services_tests.js index 9a282490f..0ce869843 100644 --- a/services_tests.js +++ b/services_tests.js @@ -1,5 +1,3 @@ -require('babel-core/register')({presets: ['es2015']}); - process.on('warning', warning => { console.log(warning.name); console.log(warning.message); @@ -17,13 +15,14 @@ var jasmine = new Jasmine(); var SpecReporter = require('jasmine-spec-reporter').SpecReporter; jasmine.loadConfig({ - spec_dir: 'services/', + spec_dir: 'services', spec_files: [ - '**/specs/*[sS]pec.js' + 'auth/server/**/*[sS]pec.js', + 'client/common/**/*[sS]pec.js', + 'loopback/common/**/*[sS]pec.js' ], helpers: [ - // to implement - // '/api/utils/jasmineHelpers.js' + '/services/utils/jasmineHelpers.js' ] }); @@ -36,6 +35,5 @@ jasmine.addReporter(new SpecReporter({ } })); -exports.start = () => { - jasmine.execute(); -}; +jasmine.execute(); + diff --git a/webpack.config.js b/webpack.config.js index c4e78fced..8062d9979 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,20 +25,19 @@ var config = { query: { presets: ['es2015'] } - }, - { + }, { + test: /\.yml$/, + loader: 'json-loader!yaml-loader' + }, { test: /\.html$/, loader: 'html-loader' - }, - { + }, { test: /\.css$/, loader: 'style-loader!css-loader' - }, - { + }, { test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader' - }, - { + }, { test: /\.(svg|png|ttf|woff|woff2)$/, loader: 'file-loader' } @@ -61,12 +60,13 @@ var config = { }; if (!devMode) { - config.plugins.push( - new webpack.optimize.UglifyJsPlugin({ - minimize: true, - compress: {warnings: false} - }) - ); + // FIXME: https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/132 + // config.plugins.push( + // new webpack.optimize.UglifyJsPlugin({ + // minimize: true, + // compress: {warnings: false} + // }) + // ); } module.exports = config;